Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: several update for instance license feature (#6940)
ecmadao0c3746baff2e
diff --git a/backend/api/v1/instance_service.go b/backend/api/v1/instance_service.goindex 76b451de85..4264a40d73 100644--- a/backend/api/v1/instance_service.go+++ b/backend/api/v1/instance_service.go@@ -410,10 +410,6 @@ func (s *InstanceService) AddDataSource(ctx context.Context, request *v1pb.AddDareturn nil, status.Errorf(codes.InvalidArgument, "instance %q has been deleted", request.Instance)}- if err := s.licenseService.IsFeatureEnabledForInstance(api.FeatureReadReplicaConnection, instance); err != nil {- return nil, status.Errorf(codes.PermissionDenied, err.Error())- }-// Test connection.if request.ValidateOnly {err := func() error {@@ -433,6 +429,10 @@ func (s *InstanceService) AddDataSource(ctx context.Context, request *v1pb.AddDareturn convertToInstance(instance), nil}+ if err := s.licenseService.IsFeatureEnabledForInstance(api.FeatureReadReplicaConnection, instance); err != nil {+ return nil, status.Errorf(codes.PermissionDenied, err.Error())+ }+principalID := ctx.Value(common.PrincipalIDContextKey).(int)if err := s.store.AddDataSourceToInstanceV2(ctx, instance.UID, principalID, instance.ResourceID, dataSource); err != nil {return nil, status.Errorf(codes.Internal, err.Error())diff --git a/backend/api/v1/sql_service.go b/backend/api/v1/sql_service.goindex 7ba5f8a0b8..f85658bc4e 100644--- a/backend/api/v1/sql_service.go+++ b/backend/api/v1/sql_service.go@@ -59,20 +59,26 @@ const (type SQLService struct {v1pb.UnimplementedSQLServiceServerstore *store.Store- licenseService enterpriseAPI.LicenseServiceschemaSyncer *schemasync.SyncerdbFactory *dbfactory.DBFactoryactivityManager *activity.Manager+ licenseService enterpriseAPI.LicenseService}// NewSQLService creates a SQLService.-func NewSQLService(store *store.Store, licenseService enterpriseAPI.LicenseService, schemaSyncer *schemasync.Syncer, dbFactory *dbfactory.DBFactory, activityManager *activity.Manager) *SQLService {+func NewSQLService(+ store *store.Store,+ schemaSyncer *schemasync.Syncer,+ dbFactory *dbfactory.DBFactory,+ activityManager *activity.Manager,+ licenseService enterpriseAPI.LicenseService,+) *SQLService {return &SQLService{store: store,- licenseService: licenseService,schemaSyncer: schemaSyncer,dbFactory: dbFactory,activityManager: activityManager,+ licenseService: licenseService,}}@@ -346,6 +352,7 @@ func (s *SQLService) doExport(ctx context.Context, request *v1pb.ExportRequest,// TODO(rebelice): we cannot deal with multi-SensitiveDataMaskType now. Fix it.SensitiveDataMaskType: db.SensitiveDataMaskTypeDefault,SensitiveSchemaInfo: sensitiveSchemaInfo,+ EnableSensitive: s.licenseService.IsFeatureEnabledForInstance(api.FeatureSensitiveData, instance) == nil,})durationNs := time.Now().UnixNano() - startif err != nil {@@ -850,6 +857,7 @@ func (s *SQLService) doQuery(ctx context.Context, request *v1pb.QueryRequest, in// TODO(rebelice): we cannot deal with multi-SensitiveDataMaskType now. Fix it.SensitiveDataMaskType: db.SensitiveDataMaskTypeDefault,SensitiveSchemaInfo: sensitiveSchemaInfo,+ EnableSensitive: s.licenseService.IsFeatureEnabledForInstance(api.FeatureSensitiveData, instance) == nil,})select {case <-ctx.Done():diff --git a/backend/plugin/db/driver.go b/backend/plugin/db/driver.goindex 56b24912ec..63f2ed1779 100644--- a/backend/plugin/db/driver.go+++ b/backend/plugin/db/driver.go@@ -457,6 +457,8 @@ type QueryContext struct {ReadOnly boolSensitiveDataMaskType SensitiveDataMaskTypeSensitiveSchemaInfo *SensitiveSchemaInfo+ // EnableSensitive will set to be true if the database instance has license.+ EnableSensitive bool// CurrentDatabase is for MySQLCurrentDatabase stringdiff --git a/backend/plugin/db/util/driverutil.go b/backend/plugin/db/util/driverutil.goindex b5c8410bfd..10d15edbc6 100644--- a/backend/plugin/db/util/driverutil.go+++ b/backend/plugin/db/util/driverutil.go@@ -183,12 +183,12 @@ func Query(ctx context.Context, dbType db.Type, conn *sql.Conn, statement string}var fieldMaskInfo []bool+ var fieldSensitiveInfo []bool+for i := range columnNames {- if len(fieldList) > 0 && fieldList[i].Sensitive {- fieldMaskInfo = append(fieldMaskInfo, true)- } else {- fieldMaskInfo = append(fieldMaskInfo, false)- }+ sensitive := len(fieldList) > 0 && fieldList[i].Sensitive+ fieldSensitiveInfo = append(fieldSensitiveInfo, sensitive)+ fieldMaskInfo = append(fieldMaskInfo, sensitive && queryContext.EnableSensitive)}columnTypes, err := rows.ColumnTypes()@@ -203,7 +203,7 @@ func Query(ctx context.Context, dbType db.Type, conn *sql.Conn, statement stringcolumnTypeNames = append(columnTypeNames, strings.ToUpper(v.DatabaseTypeName()))}- data, err := readRows(rows, dbType, columnTypes, columnTypeNames, fieldList)+ data, err := readRows(rows, dbType, columnTypes, columnTypeNames, fieldMaskInfo)if err != nil {return nil, err}@@ -212,7 +212,7 @@ func Query(ctx context.Context, dbType db.Type, conn *sql.Conn, statement stringreturn nil, err}- return []any{columnNames, columnTypeNames, data, fieldMaskInfo}, nil+ return []any{columnNames, columnTypeNames, data, fieldMaskInfo, fieldSensitiveInfo}, nil}// Query2 will execute a readonly / SELECT query.@@ -248,12 +248,11 @@ func Query2(ctx context.Context, dbType db.Type, conn *sql.Conn, statement strin}var fieldMaskInfo []bool+ var fieldSensitiveInfo []boolfor i := range columnNames {- if len(fieldList) > 0 && fieldList[i].Sensitive {- fieldMaskInfo = append(fieldMaskInfo, true)- } else {- fieldMaskInfo = append(fieldMaskInfo, false)- }+ sensitive := len(fieldList) > 0 && fieldList[i].Sensitive+ fieldSensitiveInfo = append(fieldSensitiveInfo, sensitive)+ fieldMaskInfo = append(fieldMaskInfo, sensitive && queryContext.EnableSensitive)}columnTypes, err := rows.ColumnTypes()@@ -268,7 +267,7 @@ func Query2(ctx context.Context, dbType db.Type, conn *sql.Conn, statement strincolumnTypeNames = append(columnTypeNames, strings.ToUpper(v.DatabaseTypeName()))}- data, err := readRows2(rows, columnTypes, columnTypeNames, fieldList)+ data, err := readRows2(rows, columnTypes, columnTypeNames, fieldMaskInfo)if err != nil {return nil, err}@@ -282,6 +281,7 @@ func Query2(ctx context.Context, dbType db.Type, conn *sql.Conn, statement strinColumnTypeNames: columnTypeNames,Rows: data,Masked: fieldMaskInfo,+ Sensitive: fieldSensitiveInfo,}, nil}@@ -439,7 +439,7 @@ func queryAdmin(ctx context.Context, dbType db.Type, conn *sql.Conn, statement s}// TODO(rebelice): remove the readRows and rename readRows2 to readRows if legacy API is deprecated.-func readRows2(rows *sql.Rows, columnTypes []*sql.ColumnType, columnTypeNames []string, fieldList []db.SensitiveField) ([]*v1pb.QueryRow, error) {+func readRows2(rows *sql.Rows, columnTypes []*sql.ColumnType, columnTypeNames []string, fieldMaskInfo []bool) ([]*v1pb.QueryRow, error) {var data []*v1pb.QueryRowif len(columnTypes) == 0 {// No rows.@@ -470,7 +470,7 @@ func readRows2(rows *sql.Rows, columnTypes []*sql.ColumnType, columnTypeNames []var rowData v1pb.QueryRowfor i := range columnTypes {- if len(fieldList) > 0 && fieldList[i].Sensitive {+ if len(fieldMaskInfo) > 0 && fieldMaskInfo[i] {rowData.Values = append(rowData.Values, &v1pb.RowValue{Kind: &v1pb.RowValue_StringValue{StringValue: "******"}})continue}@@ -504,9 +504,9 @@ func readRows2(rows *sql.Rows, columnTypes []*sql.ColumnType, columnTypeNames []return data, nil}-func readRows(rows *sql.Rows, dbType db.Type, columnTypes []*sql.ColumnType, columnTypeNames []string, fieldList []db.SensitiveField) ([]any, error) {+func readRows(rows *sql.Rows, dbType db.Type, columnTypes []*sql.ColumnType, columnTypeNames []string, fieldMaskInfo []bool) ([]any, error) {if dbType == db.ClickHouse {- return readRowsForClickhouse(rows, columnTypes, columnTypeNames, fieldList)+ return readRowsForClickhouse(rows, columnTypes, columnTypeNames, fieldMaskInfo)}data := []any{}for rows.Next() {@@ -533,7 +533,7 @@ func readRows(rows *sql.Rows, dbType db.Type, columnTypes []*sql.ColumnType, colrowData := []any{}for i := range columnTypes {- if len(fieldList) > 0 && fieldList[i].Sensitive {+ if len(fieldMaskInfo) > 0 && fieldMaskInfo[i] {rowData = append(rowData, "******")continue}@@ -724,7 +724,7 @@ func ConvertYesNo(s string) (bool, error) {}}-func readRowsForClickhouse(rows *sql.Rows, columnTypes []*sql.ColumnType, columnTypeNames []string, fieldList []db.SensitiveField) ([]any, error) {+func readRowsForClickhouse(rows *sql.Rows, columnTypes []*sql.ColumnType, columnTypeNames []string, fieldMaskInfo []bool) ([]any, error) {data := []any{}for rows.Next() {@@ -750,7 +750,7 @@ func readRowsForClickhouse(rows *sql.Rows, columnTypes []*sql.ColumnType, columnrowData := []any{}for i := range cols {- if len(fieldList) > 0 && fieldList[i].Sensitive {+ if len(fieldMaskInfo) > 0 && fieldMaskInfo[i] {rowData = append(rowData, "******")continue}diff --git a/backend/server/server.go b/backend/server/server.goindex c0049bb436..4c2751e974 100644--- a/backend/server/server.go+++ b/backend/server/server.go@@ -587,7 +587,7 @@ func NewServer(ctx context.Context, profile config.Profile) (*Server, error) {v1pb.RegisterIdentityProviderServiceServer(s.grpcServer, v1.NewIdentityProviderService(s.store, s.licenseService))v1pb.RegisterSettingServiceServer(s.grpcServer, v1.NewSettingService(s.store, &s.profile, s.licenseService, s.stateCfg, s.feishuProvider))v1pb.RegisterAnomalyServiceServer(s.grpcServer, v1.NewAnomalyService(s.store))- v1pb.RegisterSQLServiceServer(s.grpcServer, v1.NewSQLService(s.store, s.licenseService, s.SchemaSyncer, s.dbFactory, s.ActivityManager))+ v1pb.RegisterSQLServiceServer(s.grpcServer, v1.NewSQLService(s.store, s.SchemaSyncer, s.dbFactory, s.ActivityManager, s.licenseService))v1pb.RegisterExternalVersionControlServiceServer(s.grpcServer, v1.NewExternalVersionControlService(s.store))v1pb.RegisterRiskServiceServer(s.grpcServer, v1.NewRiskService(s.store, s.licenseService))v1pb.RegisterIssueServiceServer(s.grpcServer, v1.NewIssueService(s.store, s.ActivityManager, s.TaskScheduler, s.TaskCheckScheduler, s.RelayRunner, s.stateCfg))diff --git a/backend/tests/schema_update_test.go b/backend/tests/schema_update_test.goindex 00d493581a..c144041b30 100644--- a/backend/tests/schema_update_test.go+++ b/backend/tests/schema_update_test.go@@ -42,6 +42,7 @@ var (ColumnNames: []string{"id", "name"},ColumnTypeNames: []string{"INTEGER", "TEXT"},Masked: []bool{false, false},+ Sensitive: []bool{false, false},Rows: []*v1pb.QueryRow{{Values: []*v1pb.RowValue{diff --git a/backend/tests/sensitive_data_test.go b/backend/tests/sensitive_data_test.goindex 5fcb5ea411..e24374e41e 100644--- a/backend/tests/sensitive_data_test.go+++ b/backend/tests/sensitive_data_test.go@@ -26,6 +26,7 @@ var (ColumnNames: []string{"id", "name", "author"},ColumnTypeNames: []string{"INT", "VARCHAR", "VARCHAR"},Masked: []bool{true, false, true},+ Sensitive: []bool{true, false, true},Rows: []*v1pb.QueryRow{{Values: []*v1pb.RowValue{diff --git a/backend/tests/sql_review_test.go b/backend/tests/sql_review_test.goindex 03324b3f8b..0e9a1eff52 100644--- a/backend/tests/sql_review_test.go+++ b/backend/tests/sql_review_test.go@@ -279,6 +279,7 @@ func TestSQLReviewForMySQL(t *testing.T) {ColumnNames: []string{"count(*)"},ColumnTypeNames: []string{"BIGINT"},Masked: []bool{false},+ Sensitive: []bool{false},Rows: []*v1pb.QueryRow{{Values: []*v1pb.RowValue{diff --git a/frontend/src/components/DatabaseDetail/PITRRestoreButton.vue b/frontend/src/components/DatabaseDetail/PITRRestoreButton.vueindex 5cbe3b6eb5..3ca9922434 100644--- a/frontend/src/components/DatabaseDetail/PITRRestoreButton.vue+++ b/frontend/src/components/DatabaseDetail/PITRRestoreButton.vue@@ -239,6 +239,9 @@ const buttonActionList = computed((): PITRButtonAction[] => {});const onClickPITRButton = (action: PITRButtonAction) => {+ if (!hasPITRFeature.value) {+ return;+ }const { step, mode } = action.params;openDialog(step, mode);};diff --git a/frontend/src/components/FeatureGuard/FeatureBadge.vue b/frontend/src/components/FeatureGuard/FeatureBadge.vueindex d469b64399..5ad5639b98 100644--- a/frontend/src/components/FeatureGuard/FeatureBadge.vue+++ b/frontend/src/components/FeatureGuard/FeatureBadge.vue@@ -1,7 +1,7 @@<template><divv-if="instanceMissingLicense"- :class="['text-accentcursor-pointer', customClass]"+ :class="['text-accent cursor-pointer', customClass]"@click="state.showInstanceAssignmentDrawer = true"><NTooltip :show-arrow="true">diff --git a/frontend/src/components/FeatureGuard/FeatureBadgeForInstanceLicense.vue b/frontend/src/components/FeatureGuard/FeatureBadgeForInstanceLicense.vuenew file mode 100644index 0000000000..19afce8927--- /dev/null+++ b/frontend/src/components/FeatureGuard/FeatureBadgeForInstanceLicense.vue@@ -0,0 +1,76 @@+<template>+ <div+ v-if="show || instanceMissingLicense"+ :class="['text-accent cursor-pointer', customClass]"+ @click="state.showInstanceAssignmentDrawer = true"+ >+ <NTooltip :show-arrow="true">+ <template #trigger>+ <heroicons-outline:exclamation class="text-warning w-5 h-5" />+ </template>+ <span class="w-56 text-sm">+ {{+ $t("subscription.instance-assignment.missing-license-for-feature", {+ feature: $t(+ `subscription.features.${feature.split(".").join("-")}.title`+ ).toLowerCase(),+ })+ }}+ </span>+ </NTooltip>+ </div>+ <InstanceAssignment+ v-if="!hasFeature || show"+ :show="state.showInstanceAssignmentDrawer"+ @dismiss="state.showInstanceAssignmentDrawer = false"+ />+</template>++<script lang="ts" setup>+import { reactive, PropType, computed } from "vue";+import { FeatureType } from "@/types";+import { useSubscriptionV1Store } from "@/store";+import { Instance } from "@/types/proto/v1/instance_service";+import { NTooltip } from "naive-ui";++interface LocalState {+ showInstanceAssignmentDrawer: boolean;+}++const props = defineProps({+ show: {+ type: Boolean,+ default: false,+ },+ feature: {+ required: true,+ type: String as PropType<FeatureType>,+ },+ instance: {+ type: Object as PropType<Instance>,+ default: undefined,+ },+ customClass: {+ require: false,+ default: "",+ type: String,+ },+});++const state = reactive<LocalState>({+ showInstanceAssignmentDrawer: false,+});++const subscriptionStore = useSubscriptionV1Store();++const hasFeature = computed(() => {+ return subscriptionStore.hasInstanceFeature(props.feature, props.instance);+});++const instanceMissingLicense = computed(() => {+ return subscriptionStore.instanceMissingLicense(+ props.feature,+ props.instance+ );+});+</script>diff --git a/frontend/src/components/Issue/review/IssueReviewSidebarSection.vue b/frontend/src/components/Issue/review/IssueReviewSidebarSection.vueindex 21b55937eb..23da695db3 100644--- a/frontend/src/components/Issue/review/IssueReviewSidebarSection.vue+++ b/frontend/src/components/Issue/review/IssueReviewSidebarSection.vue@@ -40,8 +40,15 @@></div><IssueReviewPanel v-else-if="steps.length > 0" />- <div v-else class="flex items-center mt-1 text-sm text-control-placeholder">+ <div+ v-else+ class="flex items-center mt-1 text-sm text-control-placeholder gap-x-1"+ >{{ $t("custom-approval.approval-flow.skip") }}+ <FeatureBadgeForInstanceLicense+ feature="bb.feature.custom-approval"+ :instance="selectedDatabase?.instanceEntity"+ /></div></div></template>@@ -58,6 +65,7 @@ import { isGrantRequestIssueType } from "@/utils";const store = useReviewStore();const issueContext = useIssueLogic();+const { selectedDatabase } = issueContext;const issue = issueContext.issue as Ref<Issue>;const context = useIssueReviewContext();const { ready, error, flow } = context;diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 853a01f97a..d22093c11a 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -1912,7 +1912,8 @@"manage-license": "Manage Instance License","used-and-total-license": "Assigned / Total Instance License","success-notification": "Successfully update license assignment",- "missing-license-for-instances": "You have {count} instances ({name}) missing required license to unlock this feature."+ "missing-license-for-instances": "You have {count} instances ({name}) missing required license to unlock this feature.",+ "missing-license-for-feature": "Missing instance license to enable {feature}. Click to assign now."},"update": {"success": {diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 4993ecdfc4..2a96b5d418 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -1912,7 +1912,8 @@"manage-license": "Administrar licencia","used-and-total-license": "Licencia asignada / total","success-notification": "Actualizar correctamente la asignación de licencia",- "missing-license-for-instances": "Tienes {count} instancias ({name}) a las que les falta la licencia requerida para desbloquear esta función."+ "missing-license-for-instances": "Tienes {count} instancias ({name}) a las que les falta la licencia requerida para desbloquear esta función.",+ "missing-license-for-feature": "Falta la licencia de instancia para habilitar {feature}. Haga clic para asignar ahora."},"update": {"success": {diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 6c3f9bee29..e8824fcfdc 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -1907,7 +1907,8 @@"manage-license": "管理证书","used-and-total-license": "已分配 / 总实例证书","success-notification": "证书分配更新成功",- "missing-license-for-instances": "您有 {count} 个实例({name})缺失开启该功能的证书。"+ "missing-license-for-instances": "您有 {count} 个实例({name})缺失开启该功能的证书。",+ "missing-license-for-feature": "缺少实例证书以启用{feature}。点击去分配证书。"},"update": {"success": {diff --git a/frontend/src/store/modules/sqlEditor.ts b/frontend/src/store/modules/sqlEditor.tsindex 5072aaebb6..585644dfb8 100644--- a/frontend/src/store/modules/sqlEditor.ts+++ b/frontend/src/store/modules/sqlEditor.ts@@ -113,6 +113,7 @@ export const mockAffectedV1Rows0 = (): QueryResult => {columnTypeNames: ["BIGINT"],masked: [false],error: "",+ statement: "",rows: [{values: [diff --git a/frontend/src/types/proto/v1/sql_service.ts b/frontend/src/types/proto/v1/sql_service.tsindex c649dfb051..7cf91ef66c 100644--- a/frontend/src/types/proto/v1/sql_service.ts+++ b/frontend/src/types/proto/v1/sql_service.ts@@ -147,6 +147,8 @@ export interface QueryResult {rows: QueryRow[];/** Columns are masked or not. */masked: boolean[];+ /** Columns are sensitive or not. */+ sensitive: boolean[];/** The error message if the query failed. */error: string;/** The time it takes to execute the query. */@@ -800,7 +802,16 @@ export const QueryResponse = {};function createBaseQueryResult(): QueryResult {- return { columnNames: [], columnTypeNames: [], rows: [], masked: [], error: "", latency: undefined, statement: "" };+ return {+ columnNames: [],+ columnTypeNames: [],+ rows: [],+ masked: [],+ sensitive: [],+ error: "",+ latency: undefined,+ statement: "",+ };}export const QueryResult = {@@ -819,14 +830,19 @@ export const QueryResult = {writer.bool(v);}writer.ldelim();+ writer.uint32(42).fork();+ for (const v of message.sensitive) {+ writer.bool(v);+ }+ writer.ldelim();if (message.error !== "") {- writer.uint32(42).string(message.error);+ writer.uint32(50).string(message.error);}if (message.latency !== undefined) {- Duration.encode(message.latency, writer.uint32(50).fork()).ldelim();+ Duration.encode(message.latency, writer.uint32(58).fork()).ldelim();}if (message.statement !== "") {- writer.uint32(58).string(message.statement);+ writer.uint32(66).string(message.statement);}return writer;},@@ -877,24 +893,41 @@ export const QueryResult = {break;case 5:- if (tag !== 42) {- break;+ if (tag === 40) {+ message.sensitive.push(reader.bool());++ continue;}- message.error = reader.string();- continue;+ if (tag === 42) {+ const end2 = reader.uint32() + reader.pos;+ while (reader.pos < end2) {+ message.sensitive.push(reader.bool());+ }++ continue;+ }++ break;case 6:if (tag !== 50) {break;}- message.latency = Duration.decode(reader, reader.uint32());+ message.error = reader.string();continue;case 7:if (tag !== 58) {break;}+ message.latency = Duration.decode(reader, reader.uint32());+ continue;+ case 8:+ if (tag !== 66) {+ break;+ }+message.statement = reader.string();continue;}@@ -912,6 +945,7 @@ export const QueryResult = {columnTypeNames: Array.isArray(object?.columnTypeNames) ? object.columnTypeNames.map((e: any) => String(e)) : [],rows: Array.isArray(object?.rows) ? object.rows.map((e: any) => QueryRow.fromJSON(e)) : [],masked: Array.isArray(object?.masked) ? object.masked.map((e: any) => Boolean(e)) : [],+ sensitive: Array.isArray(object?.sensitive) ? object.sensitive.map((e: any) => Boolean(e)) : [],error: isSet(object.error) ? String(object.error) : "",latency: isSet(object.latency) ? Duration.fromJSON(object.latency) : undefined,statement: isSet(object.statement) ? String(object.statement) : "",@@ -940,6 +974,11 @@ export const QueryResult = {} else {obj.masked = [];}+ if (message.sensitive) {+ obj.sensitive = message.sensitive.map((e) => e);+ } else {+ obj.sensitive = [];+ }message.error !== undefined && (obj.error = message.error);message.latency !== undefined && (obj.latency = message.latency ? Duration.toJSON(message.latency) : undefined);message.statement !== undefined && (obj.statement = message.statement);@@ -956,6 +995,7 @@ export const QueryResult = {message.columnTypeNames = object.columnTypeNames?.map((e) => e) || [];message.rows = object.rows?.map((e) => QueryRow.fromPartial(e)) || [];message.masked = object.masked?.map((e) => e) || [];+ message.sensitive = object.sensitive?.map((e) => e) || [];message.error = object.error ?? "";message.latency = (object.latency !== undefined && object.latency !== null)? Duration.fromPartial(object.latency)diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/DataTable.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/DataTable.vueindex 27336f87d0..02125c9b8c 100644--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/DataTable.vue+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/DataTable.vue@@ -39,6 +39,12 @@v-if="isSensitiveColumn(header.index)"class="ml-0.5 shrink-0"/>+ <FeatureBadgeForInstanceLicense+ v-else-if="isColumnMissingSensitive(header.index)"+ :show="true"+ custom-class="ml-0.5 shrink-0"+ feature="bb.feature.sensitive-data"+ /></div><!-- The drag-to-resize handler -->@@ -105,6 +111,10 @@ const props = defineProps({type: Array as PropType<boolean[]>,default: () => [],},+ masked: {+ type: Array as PropType<boolean[]>,+ default: () => [],+ },table: {type: Object as PropType<Table<string[]>>,required: true,@@ -128,7 +138,11 @@ const tableResize = useTableColumnWidthLogic({const data = computed(() => props.data);const isSensitiveColumn = (index: number): boolean => {- return props.sensitive[index] ?? false;+ return props.masked[index] ?? false;+};++const isColumnMissingSensitive = (index: number): boolean => {+ return (props.sensitive[index] ?? false) && !isSensitiveColumn(index);};const renderCellValue = (value: any) => {diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vueindex d7f0f2ca4e..cc05cb3c61 100644--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue@@ -73,7 +73,8 @@:table="table":columns="columns":data="data"- :sensitive="sensitive"+ :masked="props.result.masked"+ :sensitive="props.result.sensitive":keyword="state.search"/></div>@@ -303,10 +304,6 @@ const data = computed(() => {return temp;});-const sensitive = computed(() => {- return props.result.masked;-});-const table = useVueTable<string[]>({get data() {return data.value;diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.mdindex 7606adf384..72197195e1 100644--- a/proto/gen/grpc-doc/v1/README.md+++ b/proto/gen/grpc-doc/v1/README.md@@ -8229,6 +8229,7 @@ The sheet's `name` field is used to identify the sheet to update. Format: pr| column_type_names | [string](#string) | repeated | Column types of the query result. The types come from the Golang SQL driver. || rows | [QueryRow](#bytebase-v1-QueryRow) | repeated | Rows of the query result. || masked | [bool](#bool) | repeated | Columns are masked or not. |+| sensitive | [bool](#bool) | repeated | Columns are sensitive or not. || error | [string](#string) | | The error message if the query failed. || latency | [google.protobuf.Duration](#google-protobuf-Duration) | | The time it takes to execute the query. || statement | [string](#string) | | The query statement for the result. |diff --git a/proto/generated-go/v1/sql_service.pb.go b/proto/generated-go/v1/sql_service.pb.goindex 37bc8dca81..77c5c936d3 100644--- a/proto/generated-go/v1/sql_service.pb.go+++ b/proto/generated-go/v1/sql_service.pb.go@@ -566,12 +566,14 @@ type QueryResult struct {Rows []*QueryRow `protobuf:"bytes,3,rep,name=rows,proto3" json:"rows,omitempty"`// Columns are masked or not.Masked []bool `protobuf:"varint,4,rep,packed,name=masked,proto3" json:"masked,omitempty"`+ // Columns are sensitive or not.+ Sensitive []bool `protobuf:"varint,5,rep,packed,name=sensitive,proto3" json:"sensitive,omitempty"`// The error message if the query failed.- Error string `protobuf:"bytes,5,opt,name=error,proto3" json:"error,omitempty"`+ Error string `protobuf:"bytes,6,opt,name=error,proto3" json:"error,omitempty"`// The time it takes to execute the query.- Latency *durationpb.Duration `protobuf:"bytes,6,opt,name=latency,proto3" json:"latency,omitempty"`+ Latency *durationpb.Duration `protobuf:"bytes,7,opt,name=latency,proto3" json:"latency,omitempty"`// The query statement for the result.- Statement string `protobuf:"bytes,7,opt,name=statement,proto3" json:"statement,omitempty"`+ Statement string `protobuf:"bytes,8,opt,name=statement,proto3" json:"statement,omitempty"`}func (x *QueryResult) Reset() {@@ -634,6 +636,13 @@ func (x *QueryResult) GetMasked() []bool {return nil}+func (x *QueryResult) GetSensitive() []bool {+ if x != nil {+ return x.Sensitive+ }+ return nil+}+func (x *QueryResult) GetError() string {if x != nil {return x.Error@@ -1198,7 +1207,7 @@ var file_v1_sql_service_proto_rawDesc = []byte{0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x2d, 0x0a, 0x07, 0x61, 0x64, 0x76, 0x69, 0x63,0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x76, 0x69, 0x63, 0x65, 0x52, 0x07, 0x61,- 0x64, 0x76, 0x69, 0x63, 0x65, 0x73, 0x22, 0x88, 0x02, 0x0a, 0x0b, 0x51, 0x75, 0x65, 0x72, 0x79,+ 0x64, 0x76, 0x69, 0x63, 0x65, 0x73, 0x22, 0xa6, 0x02, 0x0a, 0x0b, 0x51, 0x75, 0x65, 0x72, 0x79,0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e,0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f,0x6c, 0x75, 0x6d, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x63, 0x6f, 0x6c,@@ -1208,106 +1217,107 @@ var file_v1_sql_service_proto_rawDesc = []byte{0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x6f, 0x77, 0x52, 0x04, 0x72, 0x6f, 0x77, 0x73,0x12, 0x16, 0x0a, 0x06, 0x6d, 0x61, 0x73, 0x6b, 0x65, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x08,- 0x52, 0x06, 0x6d, 0x61, 0x73, 0x6b, 0x65, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f,- 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x33,- 0x0a, 0x07, 0x6c, 0x61, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32,- 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,- 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6c, 0x61, 0x74, 0x65,- 0x6e, 0x63, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74,- 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e,- 0x74, 0x22, 0x39, 0x0a, 0x08, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x6f, 0x77, 0x12, 0x2d, 0x0a,- 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e,- 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x6f, 0x77, 0x56,- 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, 0xcb, 0x03, 0x0a,- 0x08, 0x52, 0x6f, 0x77, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3b, 0x0a, 0x0a, 0x6e, 0x75, 0x6c,- 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e,+ 0x52, 0x06, 0x6d, 0x61, 0x73, 0x6b, 0x65, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x6e, 0x73,+ 0x69, 0x74, 0x69, 0x76, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x08, 0x52, 0x09, 0x73, 0x65, 0x6e,+ 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18,+ 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x33, 0x0a, 0x07,+ 0x6c, 0x61, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e,0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,- 0x4e, 0x75, 0x6c, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x09, 0x6e, 0x75, 0x6c,- 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76,- 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x09, 0x62, 0x6f,- 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x73,- 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x0a,- 0x62, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x64, 0x6f,- 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01,- 0x48, 0x00, 0x52, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12,- 0x21, 0x0a, 0x0b, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05,- 0x20, 0x01, 0x28, 0x02, 0x48, 0x00, 0x52, 0x0a, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c,- 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75,- 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x33, 0x32,- 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76,- 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x0a, 0x69, 0x6e,- 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69,- 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00,- 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a,- 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x09, 0x20,- 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x0b, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c,- 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c,- 0x75, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x0b, 0x75, 0x69, 0x6e, 0x74,- 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x39, 0x0a, 0x0b, 0x76, 0x61, 0x6c, 0x75, 0x65,- 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67,- 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56,- 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x56, 0x61, 0x6c,- 0x75, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0xf3, 0x01, 0x0a, 0x06, 0x41,- 0x64, 0x76, 0x69, 0x63, 0x65, 0x12, 0x32, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18,- 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,- 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75,- 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64,- 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a,- 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69,- 0x74, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x04,- 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a,- 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x6c, 0x69, 0x6e,- 0x65, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28,- 0x09, 0x52, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x22, 0x45, 0x0a, 0x06, 0x53, 0x74, 0x61,- 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e,- 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53,- 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x57, 0x41, 0x52, 0x4e,- 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03,- 0x22, 0x8c, 0x01, 0x0a, 0x0d, 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65,- 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01,- 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,- 0x2e, 0x45, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x52, 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x12,+ 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6c, 0x61, 0x74, 0x65, 0x6e, 0x63,+ 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x08,+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x22,+ 0x39, 0x0a, 0x08, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x6f, 0x77, 0x12, 0x2d, 0x0a, 0x06, 0x76,+ 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x62, 0x79,+ 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x6f, 0x77, 0x56, 0x61, 0x6c,+ 0x75, 0x65, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, 0xcb, 0x03, 0x0a, 0x08, 0x52,+ 0x6f, 0x77, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3b, 0x0a, 0x0a, 0x6e, 0x75, 0x6c, 0x6c, 0x5f,+ 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x67, 0x6f,+ 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4e, 0x75,+ 0x6c, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x09, 0x6e, 0x75, 0x6c, 0x6c, 0x56,+ 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c,+ 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c,+ 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x76,+ 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x0a, 0x62, 0x79,+ 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x64, 0x6f, 0x75, 0x62,+ 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x48, 0x00,+ 0x52, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a,+ 0x0b, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01,+ 0x28, 0x02, 0x48, 0x00, 0x52, 0x0a, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65,+ 0x12, 0x21, 0x0a, 0x0b, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,+ 0x06, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61,+ 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c,+ 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x36,+ 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67,+ 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b,+ 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x75,+ 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28,+ 0x0d, 0x48, 0x00, 0x52, 0x0b, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65,+ 0x12, 0x23, 0x0a, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65,+ 0x18, 0x0a, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x0b, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34,+ 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x39, 0x0a, 0x0b, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x76,+ 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f,+ 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c,+ 0x75, 0x65, 0x48, 0x00, 0x52, 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65,+ 0x42, 0x06, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0xf3, 0x01, 0x0a, 0x06, 0x41, 0x64, 0x76,+ 0x69, 0x63, 0x65, 0x12, 0x32, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20,+ 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,+ 0x31, 0x2e, 0x41, 0x64, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52,+ 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18,+ 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74,+ 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c,+ 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01,+ 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6c,+ 0x69, 0x6e, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x12,+ 0x16, 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52,+ 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x22, 0x45, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75,+ 0x73, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50,+ 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x55, 0x43,+ 0x43, 0x45, 0x53, 0x53, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x57, 0x41, 0x52, 0x4e, 0x49, 0x4e,+ 0x47, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03, 0x22, 0x8c,+ 0x01, 0x0a, 0x0d, 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,+ 0x12, 0x2b, 0x0a, 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e,+ 0x32, 0x13, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45,+ 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x52, 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x12, 0x25, 0x0a,+ 0x0e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18,+ 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x63,+ 0x68, 0x65, 0x6d, 0x61, 0x12, 0x27, 0x0a, 0x0f, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64,+ 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x65,+ 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x22, 0x60, 0x0a,+ 0x0e, 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,0x25, 0x0a, 0x0e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d,- 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74,+ 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74,0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x27, 0x0a, 0x0f, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74,- 0x65, 0x64, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,- 0x0e, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x22,- 0x60, 0x0a, 0x0e, 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,- 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x63, 0x68,- 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65,- 0x6e, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x27, 0x0a, 0x0f, 0x65, 0x78, 0x70, 0x65,- 0x63, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28,- 0x09, 0x52, 0x0e, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d,- 0x61, 0x32, 0xb3, 0x03, 0x0a, 0x0a, 0x53, 0x51, 0x4c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,- 0x12, 0x5c, 0x0a, 0x06, 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x12, 0x1a, 0x2e, 0x62, 0x79, 0x74,- 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x52,- 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,- 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f,- 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x3a, 0x01, 0x2a, 0x22, 0x0e,- 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x71, 0x6c, 0x2f, 0x70, 0x72, 0x65, 0x74, 0x74, 0x79, 0x12, 0x67,- 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x19, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,- 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65,- 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,- 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x27,- 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x3a, 0x01, 0x2a, 0x22, 0x1c, 0x2f, 0x76, 0x31, 0x2f, 0x7b,- 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a,- 0x7d, 0x3a, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x6b, 0x0a, 0x06, 0x45, 0x78, 0x70, 0x6f, 0x72,- 0x74, 0x12, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,- 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e,- 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x70, 0x6f,- 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93,- 0x02, 0x22, 0x3a, 0x01, 0x2a, 0x22, 0x1d, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65,- 0x3d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x3a, 0x65, 0x78,- 0x70, 0x6f, 0x72, 0x74, 0x12, 0x71, 0x0a, 0x0c, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x65,- 0x63, 0x75, 0x74, 0x65, 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,+ 0x65, 0x64, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,+ 0x0e, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x32,+ 0xb3, 0x03, 0x0a, 0x0a, 0x53, 0x51, 0x4c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5c,+ 0x0a, 0x06, 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x12, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,+ 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x52, 0x65, 0x71,+ 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,+ 0x76, 0x31, 0x2e, 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,+ 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x3a, 0x01, 0x2a, 0x22, 0x0e, 0x2f, 0x76,+ 0x31, 0x2f, 0x73, 0x71, 0x6c, 0x2f, 0x70, 0x72, 0x65, 0x74, 0x74, 0x79, 0x12, 0x67, 0x0a, 0x05,+ 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x19, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,+ 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,+ 0x1a, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x51,+ 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x27, 0x82, 0xd3,+ 0xe4, 0x93, 0x02, 0x21, 0x3a, 0x01, 0x2a, 0x22, 0x1c, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61,+ 0x6d, 0x65, 0x3d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x3a,+ 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x6b, 0x0a, 0x06, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x12,+ 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78,+ 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x62, 0x79,+ 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74,+ 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22,+ 0x3a, 0x01, 0x2a, 0x22, 0x1d, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x69,+ 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x3a, 0x65, 0x78, 0x70, 0x6f,+ 0x72, 0x74, 0x12, 0x71, 0x0a, 0x0c, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x65, 0x63, 0x75,+ 0x74, 0x65, 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,+ 0x2e, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71,+ 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,0x76, 0x31, 0x2e, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52,- 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,- 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74,- 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02,- 0x12, 0x12, 0x10, 0x2f, 0x76, 0x31, 0x3a, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x65, 0x63,- 0x75, 0x74, 0x65, 0x28, 0x01, 0x30, 0x01, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72,- 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,- 0x6f, 0x33,+ 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x12,+ 0x10, 0x2f, 0x76, 0x31, 0x3a, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74,+ 0x65, 0x28, 0x01, 0x30, 0x01, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74,+ 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,}var (diff --git a/proto/v1/sql_service.proto b/proto/v1/sql_service.protoindex cbb0fed5af..ef779583de 100644--- a/proto/v1/sql_service.proto+++ b/proto/v1/sql_service.proto@@ -136,14 +136,17 @@ message QueryResult {// Columns are masked or not.repeated bool masked = 4;+ // Columns are sensitive or not.+ repeated bool sensitive = 5;+// The error message if the query failed.- string error = 5;+ string error = 6;// The time it takes to execute the query.- google.protobuf.Duration latency = 6;+ google.protobuf.Duration latency = 7;// The query statement for the result.- string statement = 7;+ string statement = 8;}message QueryRow {