Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat(sql-editor): inform user that SQL Editor limits the query results (#2922)
Liu Jic25bad628315
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex a56baf7795..278cfca1cc 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -1303,7 +1303,8 @@"alter-table": "Alter table","open-connection": "Open connection","visualize-explain": "Visualize Explain",- "sql-execute-in-protected-environment": "The SQL statement below will be executed in a protected environment."+ "sql-execute-in-protected-environment": "The SQL statement below will be executed in a protected environment.",+ "rows-upper-limit": "reached the limit of query results"},"label": {"empty-label-value": "<Empty Value>",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex fb53a0374b..5ae7c86062 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -1303,7 +1303,8 @@"alter-table": "修改表结构","open-connection": "打开连接","visualize-explain": "可视化 Explain",- "sql-execute-in-protected-environment": "下面的 SQL 语句将会在受保护的环境中执行。"+ "sql-execute-in-protected-environment": "下面的 SQL 语句将会在受保护的环境中执行。",+ "rows-upper-limit": "到达查询结果条数上限"},"label": {"empty-label-value": "<空值>",diff --git a/frontend/src/store/modules/sqlEditor.ts b/frontend/src/store/modules/sqlEditor.tsindex babf05bfe5..b162e0a3fa 100644--- a/frontend/src/store/modules/sqlEditor.ts+++ b/frontend/src/store/modules/sqlEditor.ts@@ -18,6 +18,9 @@ import { useTableStore } from "./table";import { useSQLStore } from "./sql";import { useTabStore } from "./tab";+// set the limit to 10000 temporarily to avoid the query timeout and page crash+export const RESULT_ROWS_LIMIT = 10000;+export const useSQLEditorStore = defineStore("sqlEditor", {state: (): SQLEditorState => ({connectionTree: {@@ -55,8 +58,7 @@ export const useSQLEditorStore = defineStore("sqlEditor", {instanceId,databaseName,statement: statement,- // set the limit to 10000 temporarily to avoid the query timeout and page crash- limit: 10000,+ limit: RESULT_ROWS_LIMIT,});return queryResult;diff --git a/frontend/src/views/sql-editor/TablePanel/TableView.vue b/frontend/src/views/sql-editor/TablePanel/TableView.vueindex 3c249cc609..26c8b16266 100644--- a/frontend/src/views/sql-editor/TablePanel/TableView.vue+++ b/frontend/src/views/sql-editor/TablePanel/TableView.vue@@ -18,6 +18,13 @@<span class="ml-2 whitespace-nowrap text-sm text-gray-500">{{`${data.length} ${t("sql-editor.rows", data.length)}`}}</span>+ <span+ v-if="data.length === RESULT_ROWS_LIMIT"+ class="ml-2 whitespace-nowrap text-sm text-gray-500"+ >+ <span>-</span>+ <span class="ml-2">{{ $t("sql-editor.rows-upper-limit") }}</span>+ </span></div><div class="flex justify-between items-center gap-x-3"><NButton@@ -71,6 +78,7 @@ import dayjs from "dayjs";import { useTabStore, useInstanceStore } from "@/store";import { createExplainToken } from "@/utils";import DataTable from "./DataTable.vue";+import { RESULT_ROWS_LIMIT } from "@/store";interface State {search: string;