Skip to content

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

feat(sql-editor): add a notification when not select the connection (#427)

Yunwei Xiao1d9ba09c4411
diff --git a/frontend/src/composables/useExecuteSQL.ts b/frontend/src/composables/useExecuteSQL.ts
index 84d438d274..e2f911865b 100644
--- a/frontend/src/composables/useExecuteSQL.ts
+++ b/frontend/src/composables/useExecuteSQL.ts
@@ -36,6 +36,13 @@ const useExecuteSQL = () => {
const selectedStatement = currentTab.selectedStatement;
const sqlStatement = selectedStatement || queryStatement;
+ const ctx = store.state.sqlEditor.connectionContext;
+
+ if (ctx.instanceId === 0 || ctx.databaseId === 0) {
+ notify("CRITICAL", t("sql-editor.select-connection"));
+ return;
+ }
+
const { data } = parseSQL(sqlStatement);
if (isEmpty(sqlStatement)) {