Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: use maximum result rows as the fallback (#19531)
ecmadaoeac5f9619b1f
diff --git a/backend/api/v1/sql_service.go b/backend/api/v1/sql_service.goindex 4f95ac8d96..0f5e827493 100644--- a/backend/api/v1/sql_service.go+++ b/backend/api/v1/sql_service.go@@ -290,11 +290,7 @@ func (s *SQLService) Query(ctx context.Context, req *connect.Request[v1pb.QueryROption: request.QueryOption,Container: request.GetContainer(),MaximumSQLResultSize: queryRestriction.MaximumResultSize,- }- if accessGrant != nil {- // unset the query limit- queryContext.Limit = 0- queryContext.SkipMasking = accessGrant.Payload.Unmask+ SkipMasking: accessGrant != nil && accessGrant.Payload.Unmask,}if request.Schema != nil {queryContext.Schema = *request.Schemadiff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 8fe78c9627..ad100001b4 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -2861,7 +2861,8 @@"workflow": {"title": "Workflow file generation","description": "Copy the workflow files into your repository to automate SQL review and database rollouts.",- "file-hint": "Save as {filePath} in your repository"+ "file-hint": "Save as {filePath} in your repository",+ "self-hosted-runner": "Self-hosted runner"},"test-setup": {"title": "Test your first GitOps migration",diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 69b9734eb8..746b31a04f 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -2861,7 +2861,8 @@"workflow": {"title": "Generación de archivo de flujo de trabajo","description": "Copie los archivos de flujo de trabajo en su repositorio para automatizar la revisión de SQL y los despliegues de base de datos.",- "file-hint": "Guardar como {filePath} en su repositorio"+ "file-hint": "Guardar como {filePath} en su repositorio",+ "self-hosted-runner": "Runner self-hosted"},"test-setup": {"title": "Pruebe su primera migración GitOps",diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 3a2adb2d28..302b08906b 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -2861,7 +2861,8 @@"workflow": {"title": "ワークフローファイル生成","description": "ワークフローファイルをリポジトリにコピーして、SQL レビューとデータベースロールアウトを自動化します。",- "file-hint": "リポジトリ内に {filePath} として保存"+ "file-hint": "リポジトリ内に {filePath} として保存",+ "self-hosted-runner": "セルフホスト runner"},"test-setup": {"title": "最初の GitOps マイグレーションをテスト",diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex a14805db35..8c9eefa9e9 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -2861,7 +2861,8 @@"workflow": {"title": "Tạo tệp workflow","description": "Sao chép các tệp workflow vào kho lưu trữ của bạn để tự động hóa SQL review và triển khai cơ sở dữ liệu.",- "file-hint": "Lưu dưới dạng {filePath} trong kho lưu trữ của bạn"+ "file-hint": "Lưu dưới dạng {filePath} trong kho lưu trữ của bạn",+ "self-hosted-runner": "Runner tự lưu trữ"},"test-setup": {"title": "Thử nghiệm migration GitOps đầu tiên",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex bca9c670e3..31433841fd 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -2861,7 +2861,8 @@"workflow": {"title": "工作流文件生成","description": "将工作流文件复制到您的代码仓库中,以自动化 SQL 审查和数据库变更发布。",- "file-hint": "保存为仓库中的 {filePath}"+ "file-hint": "保存为仓库中的 {filePath}",+ "self-hosted-runner": "自托管 runner"},"test-setup": {"title": "测试您的首次 GitOps 迁移",diff --git a/frontend/src/store/modules/sqlEditor/editor.ts b/frontend/src/store/modules/sqlEditor/editor.tsindex fa11f2d43f..e61659d86d 100644--- a/frontend/src/store/modules/sqlEditor/editor.ts+++ b/frontend/src/store/modules/sqlEditor/editor.ts@@ -1,8 +1,9 @@import { useLocalStorage } from "@vueuse/core";import { includes } from "lodash-es";import { defineStore } from "pinia";-import { computed, ref } from "vue";+import { computed, ref, watchEffect } from "vue";import { useProjectV1Store } from "@/store";+import { useQueryDataPolicy } from "@/store/modules/v1/policy";import type { Database } from "@/types/proto-es/v1/database_service_pb";import { QueryOption_RedisRunCommandsOn } from "@/types/proto-es/v1/sql_service_pb";import {@@ -53,6 +54,16 @@ export const useSQLEditorStore = defineStore("sqlEditor", () => {{ listenToStorageChanges: false });+ const { policy: queryDataPolicy } = useQueryDataPolicy(+ storedLastViewedProject+ );++ watchEffect(() => {+ if (resultRowsLimit.value > queryDataPolicy.value.maximumResultRows) {+ resultRowsLimit.value = queryDataPolicy.value.maximumResultRows;+ }+ });+const allowViewALLProjects = computed(() => {return hasWorkspacePermissionV2("bb.projects.list");});@@ -74,6 +85,7 @@ export const useSQLEditorStore = defineStore("sqlEditor", () => {return {resultRowsLimit,+ queryDataPolicy,project: computed(() => storedLastViewedProject.value),setProject,projectContextReady,diff --git a/frontend/src/views/project/ProjectGitOpsDashboard.vue b/frontend/src/views/project/ProjectGitOpsDashboard.vueindex 1a906916b8..951824a6a0 100644--- a/frontend/src/views/project/ProjectGitOpsDashboard.vue+++ b/frontend/src/views/project/ProjectGitOpsDashboard.vue@@ -152,7 +152,9 @@<NTabPane name="github-actions" tab="GitHub Actions"><!-- Runner type toggle --><div class="flex items-center gap-x-2 mt-3">- <span class="text-sm">Self-hosted</span>+ <span class="text-sm">+ {{ $t("gitops.workflow.self-hosted-runner") }}+ </span><NSwitch v-model:value="useSelfhostRunner" /></div><!-- sql-review.yml -->diff --git a/frontend/src/views/sql-editor/EditorCommon/QueryContextSettingPopover.vue b/frontend/src/views/sql-editor/EditorCommon/QueryContextSettingPopover.vueindex 46772be268..b00a097610 100644--- a/frontend/src/views/sql-editor/EditorCommon/QueryContextSettingPopover.vue+++ b/frontend/src/views/sql-editor/EditorCommon/QueryContextSettingPopover.vue@@ -88,7 +88,7 @@<MaxRowCountSelectv-model:value="resultRowsLimit":quaternary="true"- :maximum="policy.maximumResultRows"+ :maximum="queryDataPolicy.maximumResultRows"/></div></div>@@ -101,7 +101,7 @@ import { orderBy } from "lodash-es";import { ChevronDown } from "lucide-vue-next";import { NButton, NPopover, NRadio, NRadioGroup, NTooltip } from "naive-ui";import { storeToRefs } from "pinia";-import { computed, watch, watchEffect } from "vue";+import { computed, watch } from "vue";import { useI18n } from "vue-i18n";import MaxRowCountSelect from "@/components/GrantRequestPanel/MaxRowCountSelect.vue";import {@@ -109,7 +109,6 @@ import {useSQLEditorStore,useSQLEditorTabStore,} from "@/store";-import { useQueryDataPolicy } from "@/store/modules/v1/policy";import { isValidDatabaseName } from "@/types";import { Engine } from "@/types/proto-es/v1/common_pb";import type { DataSource } from "@/types/proto-es/v1/instance_service_pb";@@ -132,12 +131,10 @@ const { t } = useI18n();const tabStore = useSQLEditorTabStore();const { connection, database } = useConnectionOfCurrentSQLEditorTab();-const { redisCommandOption, resultRowsLimit, project } = storeToRefs(+const { redisCommandOption, resultRowsLimit, queryDataPolicy } = storeToRefs(useSQLEditorStore());-const { policy } = useQueryDataPolicy(project);-const show = computed(() => {return tabStore.currentTab?.mode !== "ADMIN";});@@ -168,7 +165,7 @@ const dataSources = computed(() => {const dataSourceUnaccessibleReason = (dataSource: DataSource): string | undefined => {- if (policy.value.allowAdminDataSource) {+ if (queryDataPolicy.value.allowAdminDataSource) {return undefined;}if (dataSource.type !== DataSourceType.ADMIN) {@@ -207,10 +204,4 @@ watch(immediate: true,});--watchEffect(() => {- if (resultRowsLimit.value > policy.value.maximumResultRows) {- resultRowsLimit.value = policy.value.maximumResultRows;- }-});</script>diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vueindex 142035c471..b87c3de9ae 100644--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vue+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vue@@ -30,8 +30,8 @@:params="executeParams":database="database":result="resultSet.results[0]"- :show-export="!effectiveQueryDataPolicy.disableExport"- :maximum-export-count="effectiveQueryDataPolicy.maximumResultRows"+ :show-export="!queryDataPolicy.disableExport"+ :maximum-export-count="queryDataPolicy.maximumResultRows"@export="handleExportBtnClick"/></template>@@ -87,11 +87,11 @@:database="database":result="result":show-export="false"- :maximum-export-count="effectiveQueryDataPolicy.maximumResultRows"+ :maximum-export-count="queryDataPolicy.maximumResultRows"@export="handleExportBtnClick"/></NTabPane>- <template v-if="!effectiveQueryDataPolicy.disableExport" #suffix>+ <template v-if="!queryDataPolicy.disableExport" #suffix><div class="mb-1"><DataExportButtonsize="small"@@ -104,7 +104,7 @@]":view-mode="'DRAWER'":support-password="true"- :maximum-export-count="effectiveQueryDataPolicy.maximumResultRows"+ :maximum-export-count="queryDataPolicy.maximumResultRows"@export="($event) =>handleExportBtnClick({@@ -180,6 +180,7 @@ import {NTabs,NTooltip,} from "naive-ui";+import { storeToRefs } from "pinia";import { computed } from "vue";import { useI18n } from "vue-i18n";import { darkThemeOverrides } from "@/../naive-ui.config";@@ -192,11 +193,8 @@ import type {} from "@/components/DataExportButton.vue";import DataExportButton from "@/components/DataExportButton.vue";import { isDisallowChangeDatabaseError } from "@/composables/useExecuteSQL";-import { useSQLEditorTabStore, useSQLStore } from "@/store";-import {- usePolicyV1Store,- useQueryDataPolicy,-} from "@/store/modules/v1/policy";+import { useSQLEditorStore, useSQLEditorTabStore, useSQLStore } from "@/store";+import { usePolicyV1Store } from "@/store/modules/v1/policy";import type { SQLEditorQueryParams, SQLResultSetV1 } from "@/types";import {ExportFormat,@@ -235,10 +233,7 @@ defineEmits<{const { t } = useI18n();const policyStore = usePolicyV1Store();const tabStore = useSQLEditorTabStore();--const { policy: effectiveQueryDataPolicy } = useQueryDataPolicy(- computed(() => props.database.project)-);+const { queryDataPolicy } = storeToRefs(useSQLEditorStore());const permissionDeniedError = computed((): PermissionDeniedDetail | undefined => {@@ -291,7 +286,7 @@ const tabName = (index: number) => {};const disallowCopyingData = computed(() => {- if (effectiveQueryDataPolicy.value.disableCopyData) {+ if (queryDataPolicy.value.disableCopyData) {return true;}// If the database is provided, use its effective environment.diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vueindex 71a06916a3..da55adb386 100644--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue@@ -26,7 +26,7 @@<NTooltip :disabled="!reachQueryLimit"><template #trigger><div class="flex items-center gap-x-1 whitespace-nowrap text-sm text-gray-500">- <InfoIcon v-if="reachQueryLimit" class="w-4" />+ <InfoIcon v-if="reachQueryLimit" class="w-4 text-yellow-500" />{{ resultRowsText }}</div></template>@@ -649,7 +649,8 @@ const rows = computed((): ResultTableRow[] => {const reachQueryLimit = computed(() => {return (currentTab.value?.mode !== "ADMIN" &&- rows.value.length === editorStore.resultRowsLimit+ (rows.value.length === editorStore.resultRowsLimit ||+ rows.value.length === editorStore.queryDataPolicy.maximumResultRows));});diff --git a/frontend/src/views/sql-editor/EditorPanel/ResultPanel/BatchQuerySelect.vue b/frontend/src/views/sql-editor/EditorPanel/ResultPanel/BatchQuerySelect.vueindex 303aca079e..ede442f76e 100644--- a/frontend/src/views/sql-editor/EditorPanel/ResultPanel/BatchQuerySelect.vue+++ b/frontend/src/views/sql-editor/EditorPanel/ResultPanel/BatchQuerySelect.vue@@ -36,7 +36,7 @@:tooltip="$t('sql-editor.batch-export.tooltip', { max: MAX_EXPORT })":validate="validateExport":support-password="true"- :maximum-export-count="effectiveQueryDataPolicy.maximumResultRows"+ :maximum-export-count="queryDataPolicy.maximumResultRows"@export="handleExportBtnClick"><template #form>@@ -130,7 +130,6 @@ import {useSQLEditorTabStore,useSQLStore,} from "@/store";-import { useQueryDataPolicy } from "@/store/modules/v1/policy";import type { SQLEditorDatabaseQueryContext } from "@/types";import { ExportFormat } from "@/types/proto-es/v1/common_pb";import type { Database } from "@/types/proto-es/v1/database_service_pb";@@ -165,9 +164,7 @@ const sqlStore = useSQLStore();const showEmpty = ref<boolean>(true);const contextMenu = provideResultTabListContext();const contextMenuRef = ref<InstanceType<typeof ContextMenu>>();-const { project } = storeToRefs(useSQLEditorStore());--const { policy: effectiveQueryDataPolicy } = useQueryDataPolicy(project);+const { queryDataPolicy } = storeToRefs(useSQLEditorStore());const selectedDatabaseNameList = ref<string[]>([]);