Fix IMPORT FOREIGN SCHEMA to pass catalog and schema to JDBC metadata…#55
Open
bgiesbrecht wants to merge 1 commit into
Open
Fix IMPORT FOREIGN SCHEMA to pass catalog and schema to JDBC metadata…#55bgiesbrecht wants to merge 1 commit into
bgiesbrecht wants to merge 1 commit into
Conversation
… calls The existing implementation calls DatabaseMetaData.getTables() and getColumns() with null catalog and null schema, causing it to enumerate all catalogs. This fails on Databricks (and likely other cloud JDBC sources) where cross-catalog metadata access is restricted. Changes: - Add 'catalog' server option so users can specify the remote catalog - Thread catalog (from server option) and schema (from the SQL statement's remote_schema) through the full call chain: jdbcImportForeignSchema -> jq_get_schema_info -> jq_get_table_names and jq_get_column_infos -> Java getTableNames/getColumnNames/ getColumnTypes/getPrimaryKey - Java methods now accept optional catalog and schema parameters and pass them to DatabaseMetaData.getTables/getColumns/getPrimaryKeys - Add support for LIMIT TO and EXCEPT table filtering - Generated CREATE FOREIGN TABLE statements now include table_name in OPTIONS and properly quote column names with quote_identifier() - Backward compatible: existing no-arg Java methods delegate to the new overloads with null defaults Tested with Databricks OSS JDBC driver 3.3.1 against Unity Catalog.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The existing implementation calls DatabaseMetaData.getTables() and getColumns() with null catalog and null schema, causing it to enumerate all catalogs. This fails on Databricks (and likely other cloud JDBC sources) where cross-catalog metadata access is restricted.
Changes:
Tested with Databricks OSS JDBC driver 3.3.1 against Unity Catalog.