This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new e5539102400 fix(sqllab): add filterBySqlLab prop to decouple 
expose_in_sqllab filter from UI rendering mode (#42440)
e5539102400 is described below

commit e553910240052d5ed9f7516ad130d6a8b5627334
Author: PRATHAMESH HUKKERI <[email protected]>
AuthorDate: Thu Jul 30 02:42:02 2026 +0530

    fix(sqllab): add filterBySqlLab prop to decouple expose_in_sqllab filter 
from UI rendering mode (#42440)
    
    Co-authored-by: Prathamesh Hukkeri <[email protected]>
---
 .../src/SqlLab/components/SqlEditorLeftBar/index.tsx   |  1 +
 .../DatabaseSelector/DatabaseSelector.test.tsx         | 18 ++++++++++++++++++
 .../src/components/DatabaseSelector/index.tsx          |  5 +++--
 .../src/components/DatabaseSelector/types.ts           |  1 +
 4 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx 
b/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx
index 9071f3a0507..376cc982740 100644
--- a/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx
+++ b/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx
@@ -160,6 +160,7 @@ const SqlEditorLeftBar = ({
         }
         schema={modalSchema?.value}
         sqlLabMode={false}
+        filterBySqlLab
       />
       <Flex justify="flex-end" gap="small">
         <Button
diff --git 
a/superset-frontend/src/components/DatabaseSelector/DatabaseSelector.test.tsx 
b/superset-frontend/src/components/DatabaseSelector/DatabaseSelector.test.tsx
index cd8382c323c..71c8afe8f64 100644
--- 
a/superset-frontend/src/components/DatabaseSelector/DatabaseSelector.test.tsx
+++ 
b/superset-frontend/src/components/DatabaseSelector/DatabaseSelector.test.tsx
@@ -442,3 +442,21 @@ test('Sends the correct schema when changing the schema', 
async () => {
   );
   expect(props.onSchemaChange).toHaveBeenCalledTimes(1);
 });
+
+test('should include expose_in_sqllab filter when filterBySqlLab is true', 
async () => {
+  const props = createProps();
+  render(<DatabaseSelector {...props} sqlLabMode={false} filterBySqlLab />, {
+    useRedux: true,
+    store,
+  });
+  const select = screen.getByRole('combobox', {
+    name: 'Select database or type to search databases',
+  });
+  await userEvent.click(select);
+  await waitFor(() => {
+    const calls = fetchMock.callHistory.calls(databaseApiRoute);
+    expect(calls.length).toBeGreaterThanOrEqual(1);
+    const lastCall = calls[calls.length - 1];
+    expect(lastCall.url).toContain('expose_in_sqllab');
+  });
+});
diff --git a/superset-frontend/src/components/DatabaseSelector/index.tsx 
b/superset-frontend/src/components/DatabaseSelector/index.tsx
index cfa045462f2..2ff0f0851c4 100644
--- a/superset-frontend/src/components/DatabaseSelector/index.tsx
+++ b/superset-frontend/src/components/DatabaseSelector/index.tsx
@@ -188,6 +188,7 @@ export function DatabaseSelector({
   readOnly = false,
   compactMode = false,
   sqlLabMode = false,
+  filterBySqlLab = false,
   onOpenModal,
 }: DatabaseSelectorProps) {
   const showCatalogSelector = !!db?.allow_multi_catalog;
@@ -228,7 +229,7 @@ export function DatabaseSelector({
           order_direction: 'asc',
           page,
           page_size: pageSize,
-          ...(formMode || !sqlLabMode
+          ...(formMode || !(sqlLabMode || filterBySqlLab)
             ? { filters: [{ col: 'database_name', opr: 'ct', value: search }] }
             : {
                 filters: [
@@ -278,7 +279,7 @@ export function DatabaseSelector({
           };
         });
       },
-    [formMode, getDbList, sqlLabMode, onEmptyResults],
+    [formMode, getDbList, sqlLabMode, filterBySqlLab, onEmptyResults],
   );
 
   useEffect(() => {
diff --git a/superset-frontend/src/components/DatabaseSelector/types.ts 
b/superset-frontend/src/components/DatabaseSelector/types.ts
index 886fa28332d..6f5058107cd 100644
--- a/superset-frontend/src/components/DatabaseSelector/types.ts
+++ b/superset-frontend/src/components/DatabaseSelector/types.ts
@@ -50,6 +50,7 @@ export interface DatabaseSelectorProps {
   schema?: string;
   readOnly?: boolean;
   sqlLabMode?: boolean;
+  filterBySqlLab?: boolean;
   compactMode?: boolean;
   onOpenModal?: () => void;
 }

Reply via email to