Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: allow export should set in each result set (#15764)

ecmadaoa87ca108d681
diff --git a/backend/api/v1/audit.go b/backend/api/v1/audit.go
index ce9f67e195..ed70f6b497 100644
--- a/backend/api/v1/audit.go
+++ b/backend/api/v1/audit.go
@@ -479,8 +479,7 @@ func redactQueryResponse(r *v1pb.QueryResponse) *v1pb.QueryResponse {
return nil
}
n := &v1pb.QueryResponse{
- Results: nil,
- AllowExport: r.AllowExport,
+ Results: nil,
}
for _, result := range r.Results {
n.Results = append(n.Results, &v1pb.QueryResult{
@@ -494,6 +493,7 @@ func redactQueryResponse(r *v1pb.QueryResponse) *v1pb.QueryResponse {
Latency: result.Latency,
Statement: result.Statement,
DetailedError: result.DetailedError,
+ AllowExport: result.AllowExport,
})
}
return n
diff --git a/backend/api/v1/sql_service.go b/backend/api/v1/sql_service.go
index cb7b5a2ad0..1b4fa8fb4e 100644
--- a/backend/api/v1/sql_service.go
+++ b/backend/api/v1/sql_service.go
@@ -225,7 +225,21 @@ func (s *SQLService) Query(ctx context.Context, request *v1pb.QueryRequest) (*v1
if request.Schema != nil {
queryContext.Schema = *request.Schema
}
- results, spans, duration, queryErr := queryRetry(ctx, s.store, user, instance, database, driver, conn, statement, queryContext, false, s.licenseService, s.accessCheck, s.schemaSyncer, storepb.MaskingExceptionPolicy_MaskingException_QUERY)
+ results, spans, duration, queryErr := queryRetry(
+ ctx,
+ s.store,
+ user,
+ instance,
+ database,
+ driver,
+ conn,
+ statement,
+ queryContext,
+ s.licenseService,
+ s.accessCheck,
+ s.schemaSyncer,
+ storepb.MaskingExceptionPolicy_MaskingException_QUERY,
+ )
// Update activity.
if err = s.createQueryHistory(ctx, database, store.QueryHistoryTypeQuery, statement, user.ID, duration, queryErr); err != nil {
@@ -259,13 +273,14 @@ func (s *SQLService) Query(ctx context.Context, request *v1pb.QueryRequest) (*v1
return nil, status.Error(code, queryErr.Error())
}
- // AllowExport is a validate only check.
- checkErr := s.accessCheck(ctx, instance, database, user, spans, queryContext.Limit, request.Explain, true /* isExport */)
- allowExport := (checkErr == nil)
+ for _, result := range results {
+ // AllowExport is a validate only check.
+ checkErr := s.accessCheck(ctx, instance, database, user, spans, int(result.RowsCount), request.Explain, true /* isExport */)
+ result.AllowExport = checkErr == nil
+ }
response := &v1pb.QueryResponse{
- Results: results,
- AllowExport: allowExport,
+ Results: results,
}
return response, nil
@@ -402,7 +417,6 @@ func queryRetry(
conn *sql.Conn,
statement string,
queryContext db.QueryContext,
- isExport bool,
licenseService enterprise.LicenseService,
optionalAccessCheck accessCheckFunc,
schemaSyncer *schemasync.Syncer,
@@ -435,7 +449,8 @@ func queryRetry(
slog.Debug("failed to replace backup table with source", log.BBError(err))
}
if optionalAccessCheck != nil {
- if err := optionalAccessCheck(ctx, instance, database, user, spans, queryContext.Limit, queryContext.Explain, isExport); err != nil {
+ // Check query access
+ if err := optionalAccessCheck(ctx, instance, database, user, spans, queryContext.Limit, queryContext.Explain, false); err != nil {
return nil, nil, time.Duration(0), err
}
}
@@ -455,6 +470,7 @@ func queryRetry(
if queryContext.Explain {
return results, nil, duration, nil
}
+
syncDatabaseMap := make(map[string]bool)
for i, r := range results {
if r.Error != "" {
@@ -844,7 +860,21 @@ func DoExport(
OperatorEmail: user.Email,
MaximumSQLResultSize: maximumSQLResultSize,
}
- results, spans, duration, queryErr := queryRetry(ctx, stores, user, instance, database, driver, conn, request.Statement, queryContext, true, licenseService, optionalAccessCheck, schemaSyncer, storepb.MaskingExceptionPolicy_MaskingException_EXPORT)
+ results, spans, duration, queryErr := queryRetry(
+ ctx,
+ stores,
+ user,
+ instance,
+ database,
+ driver,
+ conn,
+ request.Statement,
+ queryContext,
+ licenseService,
+ optionalAccessCheck,
+ schemaSyncer,
+ storepb.MaskingExceptionPolicy_MaskingException_EXPORT,
+ )
if queryErr != nil {
return nil, duration, err
}
@@ -852,6 +882,12 @@ func DoExport(
if len(results) > 1 {
results = results[len(results)-1:]
}
+ if len(results) == 1 {
+ if err := optionalAccessCheck(ctx, instance, database, user, spans, int(results[0].RowsCount), queryContext.Explain, true); err != nil {
+ return nil, duration, err
+ }
+ }
+
if results[0].GetError() != "" {
return nil, duration, errors.New(results[0].GetError())
}
diff --git a/backend/tests/sensitive_data_test.go b/backend/tests/sensitive_data_test.go
index ec02396bd0..53dae68cf5 100644
--- a/backend/tests/sensitive_data_test.go
+++ b/backend/tests/sensitive_data_test.go
@@ -42,8 +42,9 @@ var (
},
},
},
- Statement: "SELECT * FROM tech_book",
- RowsCount: 3,
+ Statement: "SELECT * FROM tech_book",
+ RowsCount: 3,
+ AllowExport: true,
}
originData = &v1pb.QueryResult{
ColumnNames: []string{"id", "name", "author"},
diff --git a/backend/tests/sql_review_test.go b/backend/tests/sql_review_test.go
index ce2e2551da..795e6f8306 100644
--- a/backend/tests/sql_review_test.go
+++ b/backend/tests/sql_review_test.go
@@ -238,8 +238,9 @@ func TestSQLReviewForMySQL(t *testing.T) {
},
},
},
- Statement: "SELECT count(*) FROM test WHERE 1=1;",
- RowsCount: 1,
+ Statement: "SELECT count(*) FROM test WHERE 1=1;",
+ RowsCount: 1,
+ AllowExport: true,
}
)
diff --git a/frontend/src/composables/useExecuteSQL.ts b/frontend/src/composables/useExecuteSQL.ts
index 677b115afb..478b149db6 100644
--- a/frontend/src/composables/useExecuteSQL.ts
+++ b/frontend/src/composables/useExecuteSQL.ts
@@ -228,7 +228,6 @@ const useExecuteSQL = () => {
error: "",
results: [],
advices: [],
- allowExport: false,
});
}
queryContext.results = queryResultMap;
@@ -239,7 +238,6 @@ const useExecuteSQL = () => {
results: [],
advices: result.advices,
status: result.status,
- allowExport: false,
});
};
const abort = (error: string, advices: Advice[] = []) => {
@@ -248,7 +246,6 @@ const useExecuteSQL = () => {
results: [],
advices,
status: Status.ABORTED,
- allowExport: false,
});
return cleanup();
};
@@ -294,7 +291,6 @@ const useExecuteSQL = () => {
// and mock an "Aborted" result for the rest queries.
fail(database, {
advices: [],
- allowExport: false,
error: "AbortError: The user aborted a request.",
results: [],
status: Status.ABORTED,
@@ -317,7 +313,6 @@ const useExecuteSQL = () => {
if (!dataSourceId) {
fail(database, {
advices: [],
- allowExport: false,
error:
"No queriable data source. Please check the data source query policy on environment or project.",
results: [],
diff --git a/frontend/src/store/modules/sqlEditor/webTerminal.ts b/frontend/src/store/modules/sqlEditor/webTerminal.ts
index 61b8a44c31..96ece5a223 100644
--- a/frontend/src/store/modules/sqlEditor/webTerminal.ts
+++ b/frontend/src/store/modules/sqlEditor/webTerminal.ts
@@ -204,7 +204,6 @@ const createStreamingQueryController = (tab: SQLEditorTab) => {
events.emit("result", {
error: "",
advices: [],
- allowExport: false,
...response,
});
},
@@ -216,7 +215,6 @@ const createStreamingQueryController = (tab: SQLEditorTab) => {
status: extractGrpcStatusCode(error),
advices: [],
results: [],
- allowExport: false,
};
if (result.status === Status.ABORTED && !result.error) {
result.error = "Aborted";
diff --git a/frontend/src/store/modules/v1/sql.ts b/frontend/src/store/modules/v1/sql.ts
index 884c76bcbb..7f376d230f 100644
--- a/frontend/src/store/modules/v1/sql.ts
+++ b/frontend/src/store/modules/v1/sql.ts
@@ -58,7 +58,6 @@ export const useSQLStore = defineStore("sql", () => {
error: extractGrpcErrorMessage(err),
results: [],
advices: getSqlReviewReports(err),
- allowExport: false,
status: err instanceof ClientError ? err.code : Status.UNKNOWN,
};
}
diff --git a/frontend/src/types/proto/v1/sql_service.ts b/frontend/src/types/proto/v1/sql_service.ts
index 9aeb9fe7e1..f35519eef2 100644
--- a/frontend/src/types/proto/v1/sql_service.ts
+++ b/frontend/src/types/proto/v1/sql_service.ts
@@ -92,8 +92,6 @@ export interface QueryRequest {
export interface QueryResponse {
/** The query results. */
results: QueryResult[];
- /** The query is allowed to be exported or not. */
- allowExport: boolean;
}
export interface QueryOption {
@@ -177,7 +175,11 @@ export interface QueryResult {
| undefined;
/** The query statement for the result. */
statement: string;
- postgresError?: QueryResult_PostgresError | undefined;
+ postgresError?:
+ | QueryResult_PostgresError
+ | undefined;
+ /** The query result is allowed to be exported or not. */
+ allowExport: boolean;
}
/**
@@ -1035,7 +1037,7 @@ export const QueryRequest: MessageFns<QueryRequest> = {
};
function createBaseQueryResponse(): QueryResponse {
- return { results: [], allowExport: false };
+ return { results: [] };
}
export const QueryResponse: MessageFns<QueryResponse> = {
@@ -1043,9 +1045,6 @@ export const QueryResponse: MessageFns<QueryResponse> = {
for (const v of message.results) {
QueryResult.encode(v!, writer.uint32(10).fork()).join();
}
- if (message.allowExport !== false) {
- writer.uint32(24).bool(message.allowExport);
- }
return writer;
},
@@ -1064,14 +1063,6 @@ export const QueryResponse: MessageFns<QueryResponse> = {
message.results.push(QueryResult.decode(reader, reader.uint32()));
continue;
}
- case 3: {
- if (tag !== 24) {
- break;
- }
-
- message.allowExport = reader.bool();
- continue;
- }
}
if ((tag & 7) === 4 || tag === 0) {
break;
@@ -1084,7 +1075,6 @@ export const QueryResponse: MessageFns<QueryResponse> = {
fromJSON(object: any): QueryResponse {
return {
results: globalThis.Array.isArray(object?.results) ? object.results.map((e: any) => QueryResult.fromJSON(e)) : [],
- allowExport: isSet(object.allowExport) ? globalThis.Boolean(object.allowExport) : false,
};
},
@@ -1093,9 +1083,6 @@ export const QueryResponse: MessageFns<QueryResponse> = {
if (message.results?.length) {
obj.results = message.results.map((e) => QueryResult.toJSON(e));
}
- if (message.allowExport !== false) {
- obj.allowExport = message.allowExport;
- }
return obj;
},
@@ -1105,7 +1092,6 @@ export const QueryResponse: MessageFns<QueryResponse> = {
fromPartial(object: DeepPartial<QueryResponse>): QueryResponse {
const message = createBaseQueryResponse();
message.results = object.results?.map((e) => QueryResult.fromPartial(e)) || [];
- message.allowExport = object.allowExport ?? false;
return message;
},
};
@@ -1185,6 +1171,7 @@ function createBaseQueryResult(): QueryResult {
latency: undefined,
statement: "",
postgresError: undefined,
+ allowExport: false,
};
}
@@ -1224,6 +1211,9 @@ export const QueryResult: MessageFns<QueryResult> = {
if (message.postgresError !== undefined) {
QueryResult_PostgresError.encode(message.postgresError, writer.uint32(74).fork()).join();
}
+ if (message.allowExport !== false) {
+ writer.uint32(88).bool(message.allowExport);
+ }
return writer;
},
@@ -1334,6 +1324,14 @@ export const QueryResult: MessageFns<QueryResult> = {
message.postgresError = QueryResult_PostgresError.decode(reader, reader.uint32());
continue;
}
+ case 11: {
+ if (tag !== 88) {
+ break;
+ }
+
+ message.allowExport = reader.bool();
+ continue;
+ }
}
if ((tag & 7) === 4 || tag === 0) {
break;
@@ -1361,6 +1359,7 @@ export const QueryResult: MessageFns<QueryResult> = {
latency: isSet(object.latency) ? Duration.fromJSON(object.latency) : undefined,
statement: isSet(object.statement) ? globalThis.String(object.statement) : "",
postgresError: isSet(object.postgresError) ? QueryResult_PostgresError.fromJSON(object.postgresError) : undefined,
+ allowExport: isSet(object.allowExport) ? globalThis.Boolean(object.allowExport) : false,
};
},
@@ -1396,6 +1395,9 @@ export const QueryResult: MessageFns<QueryResult> = {
if (message.postgresError !== undefined) {
obj.postgresError = QueryResult_PostgresError.toJSON(message.postgresError);
}
+ if (message.allowExport !== false) {
+ obj.allowExport = message.allowExport;
+ }
return obj;
},
@@ -1420,6 +1422,7 @@ export const QueryResult: MessageFns<QueryResult> = {
message.postgresError = (object.postgresError !== undefined && object.postgresError !== null)
? QueryResult_PostgresError.fromPartial(object.postgresError)
: undefined;
+ message.allowExport = object.allowExport ?? false;
return message;
},
};
diff --git a/frontend/src/utils/iam/permission-utils.ts b/frontend/src/utils/iam/permission-utils.ts
index 692d3a1ec6..a13a2fed88 100644
--- a/frontend/src/utils/iam/permission-utils.ts
+++ b/frontend/src/utils/iam/permission-utils.ts
@@ -1,18 +1,10 @@
import type { ComposedDatabase, ComposedProject } from "@/types";
import { hasProjectPermissionV2 } from "./permission";
-const hasPermissionToCreateRequestGrantIssueInProject = (
- project: ComposedProject
-) => {
- return hasProjectPermissionV2(project, "bb.issues.create");
-};
-
export const hasPermissionToCreateRequestGrantIssue = (
database: ComposedDatabase
) => {
- return hasPermissionToCreateRequestGrantIssueInProject(
- database.projectEntity
- );
+ return hasProjectPermissionV2(database.projectEntity, "bb.issues.create");
};
export const hasPermissionToCreateChangeDatabaseIssueInProject = (
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vue
index 39cc72749b..baa4c28d33 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vue
@@ -17,7 +17,6 @@
:params="executeParams"
:database="database"
:result="resultSet.results[0]"
- :allow-export="resultSet.allowExport"
:set-index="0"
/>
</template>
@@ -52,7 +51,6 @@
:params="executeParams"
:database="database"
:result="result"
- :allow-export="resultSet.allowExport"
:set-index="i"
/>
</NTabPane>
@@ -277,7 +275,7 @@ const filteredResults = computed(() => {
}
// Skip SET commands when displaying results
- return props.resultSet.results.filter(result => {
+ return props.resultSet.results.filter((result) => {
return !result.statement.trim().toUpperCase().startsWith("SET");
});
});
@@ -287,18 +285,21 @@ const filteredResults = computed(() => {
const columnTypeNamesRef = computed(() => {
// If no result set, return undefined
if (!props.resultSet?.results) return undefined;
-
+
// For single result mode, use the first result
if (viewMode.value === "SINGLE-RESULT") {
return props.resultSet.results[0]?.columnTypeNames;
}
-
+
// For multi-result mode, use the active tab's result
// The active tab corresponds to the detail.set value
- if (viewMode.value === "MULTI-RESULT" && detail.value.set < filteredResults.value.length) {
+ if (
+ viewMode.value === "MULTI-RESULT" &&
+ detail.value.set < filteredResults.value.length
+ ) {
return filteredResults.value[detail.value.set]?.columnTypeNames;
}
-
+
return undefined;
});
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue
index abacf2189e..3b27999621 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue
@@ -80,7 +80,7 @@
</NTooltip>
<template v-if="!disallowExportQueryData">
<DataExportButton
- v-if="allowExport"
+ v-if="result.allowExport"
size="small"
:file-type="'zip'"
:disabled="props.result === null || isEmpty(props.result)"
@@ -248,7 +248,6 @@ const props = defineProps<{
database?: ComposedDatabase;
result: QueryResult;
setIndex: number;
- allowExport: boolean;
}>();
const state = reactive<LocalState>({
@@ -342,14 +341,14 @@ const columns = computed(() => {
return props.result.columnNames.map<ColumnDef<QueryRow, RowValue>>(
(columnName, index) => {
const columnType = props.result.columnTypeNames[index] as string;
-
+
return {
id: `${columnName}@${index}`,
accessorFn: (item) => item.values[index],
header: columnName,
meta: {
// Store column type in meta for easy access by other components
- columnType: columnType
+ columnType: columnType,
},
sortingFn: (rowA, rowB) => {
return compareQueryRowValues(
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index e825801c7d..083bfe6d17 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -11707,9 +11707,6 @@ components:
items:
$ref: '#/components/schemas/QueryResult'
description: The query results.
- allowExport:
- type: boolean
- description: The query is allowed to be exported or not.
QueryResult:
type: object
properties:
@@ -11754,6 +11751,9 @@ components:
description: The query statement for the result.
postgresError:
$ref: '#/components/schemas/QueryResult_PostgresError'
+ allowExport:
+ type: boolean
+ description: The query result is allowed to be exported or not.
QueryResult_PostgresError:
type: object
properties:
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 437f488e4a..1f2d3ee830 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -8979,7 +8979,6 @@ TYPE_PROJECT_REPOSITORY_PUSH represents Bytebase receiving a push event from the
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| results | [QueryResult](#bytebase-v1-QueryResult) | repeated | The query results. |
-| allow_export | [bool](#bool) | | The query is allowed to be exported or not. |
@@ -9004,6 +9003,7 @@ TYPE_PROJECT_REPOSITORY_PUSH represents Bytebase receiving a push event from the
| latency | [google.protobuf.Duration](#google-protobuf-Duration) | | The time it takes to execute the query. |
| statement | [string](#string) | | The query statement for the result. |
| postgres_error | [QueryResult.PostgresError](#bytebase-v1-QueryResult-PostgresError) | | |
+| allow_export | [bool](#bool) | | The query result is allowed to be exported or not. |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index b67bb5d71e..0e3b72e6ad 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -24784,13 +24784,6 @@ CosmosDB only. </p></td>
<td><p>The query results. </p></td>
</tr>
- <tr>
- <td>allow_export</td>
- <td><a href="#bool">bool</a></td>
- <td></td>
- <td><p>The query is allowed to be exported or not. </p></td>
- </tr>
-
</tbody>
</table>
@@ -24879,6 +24872,13 @@ The types come from the Golang SQL driver. </p></td>
<td><p> </p></td>
</tr>
+ <tr>
+ <td>allow_export</td>
+ <td><a href="#bool">bool</a></td>
+ <td></td>
+ <td><p>The query result is allowed to be exported or not. </p></td>
+ </tr>
+
</tbody>
</table>
diff --git a/proto/generated-go/v1/sql_service.pb.go b/proto/generated-go/v1/sql_service.pb.go
index e72ce7b707..12db2a0278 100644
--- a/proto/generated-go/v1/sql_service.pb.go
+++ b/proto/generated-go/v1/sql_service.pb.go
@@ -477,9 +477,7 @@ func (x *QueryRequest) GetContainer() string {
type QueryResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The query results.
- Results []*QueryResult `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"`
- // The query is allowed to be exported or not.
- AllowExport bool `protobuf:"varint,3,opt,name=allow_export,json=allowExport,proto3" json:"allow_export,omitempty"`
+ Results []*QueryResult `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -521,13 +519,6 @@ func (x *QueryResponse) GetResults() []*QueryResult {
return nil
}
-func (x *QueryResponse) GetAllowExport() bool {
- if x != nil {
- return x.AllowExport
- }
- return false
-}
-
type QueryOption struct {
state protoimpl.MessageState `protogen:"open.v1"`
RedisRunCommandsOn QueryOption_RedisRunCommandsOn `protobuf:"varint,1,opt,name=redis_run_commands_on,json=redisRunCommandsOn,proto3,enum=bytebase.v1.QueryOption_RedisRunCommandsOn" json:"redis_run_commands_on,omitempty"`
@@ -596,6 +587,8 @@ type QueryResult struct {
//
// *QueryResult_PostgresError_
DetailedError isQueryResult_DetailedError `protobuf_oneof:"detailed_error"`
+ // The query result is allowed to be exported or not.
+ AllowExport bool `protobuf:"varint,11,opt,name=allow_export,json=allowExport,proto3" json:"allow_export,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -709,6 +702,13 @@ func (x *QueryResult) GetPostgresError() *QueryResult_PostgresError {
return nil
}
+func (x *QueryResult) GetAllowExport() bool {
+ if x != nil {
+ return x.AllowExport
+ }
+ return false
+}
+
type isQueryResult_DetailedError interface {
isQueryResult_DetailedError()
}
@@ -2587,16 +2587,15 @@ const file_v1_sql_service_proto_rawDesc = "" +
" \x01(\tH\x01R\tcontainer\x88\x01\x01B\t\n" +
"\a_schemaB\f\n" +
"\n" +
- "_containerJ\x04\b\x02\x10\x03\"l\n" +
+ "_containerJ\x04\b\x02\x10\x03\"I\n" +
"\rQueryResponse\x122\n" +
- "\aresults\x18\x01 \x03(\v2\x18.bytebase.v1.QueryResultR\aresults\x12!\n" +
- "\fallow_export\x18\x03 \x01(\bR\vallowExportJ\x04\b\x02\x10\x03\"\xca\x01\n" +
+ "\aresults\x18\x01 \x03(\v2\x18.bytebase.v1.QueryResultR\aresultsJ\x04\b\x02\x10\x03\"\xca\x01\n" +
"\vQueryOption\x12^\n" +
"\x15redis_run_commands_on\x18\x01 \x01(\x0e2+.bytebase.v1.QueryOption.RedisRunCommandsOnR\x12redisRunCommandsOn\"[\n" +
"\x12RedisRunCommandsOn\x12%\n" +
"!REDIS_RUN_COMMANDS_ON_UNSPECIFIED\x10\x00\x12\x0f\n" +
"\vSINGLE_NODE\x10\x01\x12\r\n" +
- "\tALL_NODES\x10\x02\"\xa8\a\n" +
+ "\tALL_NODES\x10\x02\"\xcb\a\n" +
"\vQueryResult\x12!\n" +
"\fcolumn_names\x18\x01 \x03(\tR\vcolumnNames\x12*\n" +
"\x11column_type_names\x18\x02 \x03(\tR\x0fcolumnTypeNames\x12)\n" +
@@ -2609,7 +2608,8 @@ const file_v1_sql_service_proto_rawDesc = "" +
"\x05error\x18\x06 \x01(\tR\x05error\x123\n" +
"\alatency\x18\a \x01(\v2\x19.google.protobuf.DurationR\alatency\x12\x1c\n" +
"\tstatement\x18\b \x01(\tR\tstatement\x12O\n" +
- "\x0epostgres_error\x18\t \x01(\v2&.bytebase.v1.QueryResult.PostgresErrorH\x00R\rpostgresError\x1a\xfd\x03\n" +
+ "\x0epostgres_error\x18\t \x01(\v2&.bytebase.v1.QueryResult.PostgresErrorH\x00R\rpostgresError\x12!\n" +
+ "\fallow_export\x18\v \x01(\bR\vallowExport\x1a\xfd\x03\n" +
"\rPostgresError\x12\x1a\n" +
"\bseverity\x18\x01 \x01(\tR\bseverity\x12\x12\n" +
"\x04code\x18\x02 \x01(\tR\x04code\x12\x18\n" +
diff --git a/proto/v1/sql_service.proto b/proto/v1/sql_service.proto
index 19c5ed9112..de602bd9d3 100644
--- a/proto/v1/sql_service.proto
+++ b/proto/v1/sql_service.proto
@@ -181,9 +181,6 @@ message QueryResponse {
// The query results.
repeated QueryResult results = 1;
-
- // The query is allowed to be exported or not.
- bool allow_export = 3;
}
message QueryOption {
@@ -249,6 +246,9 @@ message QueryResult {
int32 line = 16;
string routine = 17;
}
+
+ // The query result is allowed to be exported or not.
+ bool allow_export = 11;
}
message QueryRow {