duckdb: Show catalog (database) where applicable (e.g. Motherduck) #7599
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Description
This PR fixes the DuckDB query runner's schema browser to properly display database/catalog names when using MotherDuck or attached databases.
When connecting to MotherDuck (e.g., using
md:?motherduck_token={access_token}), the schema browser was only showingschema.table(e.g.,kaggle.movies) instead of the full three-part namedatabase.schema.table(e.g.,sample_data.kaggle.movies). Updated the schema retrieval query to includetable_catalogfrominformation_schema.tablesand construct the full table name accordingly.The implementation handles two use cases:
main.usersto avoid unnecessary cluttersample_data.kaggle.moviesto properly distinguish between databasesCompatible with all DuckDB versions that support the
information_schema.tablesview withtable_catalogcolumn (including the version currently used by redash).Implementation note: the code (and parts of this pull request description) were written by Claude 4.5 Sonnet, with human intervention and review.
How is this tested?
Unit Tests Added:
test_motherduck_catalog_included: Verifies that non-default catalogs include the catalog name in table namestable_catalogfield in mock dataManual Testing:
md:?motherduck_token={access_token}sample_data.kaggle.movies)main.users)Related Tickets & Documents
N/A
Mobile & Desktop Screenshots/Recordings (if there are UI changes)
No UI changes but FWIW here's a screenshot of the support using a connection to Motherduck and its default sample data: