-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
[bigquery][jdbc] DatabaseMetaData.getTables() fails for Analytics Hub linked datasets
Thanks for stopping by to let us know something could be better!
Environment details
- API: BigQuery (JDBC / metadata discovery)
- OS type and version: macOS 14.x (Apple Silicon)
- Java version: OpenJDK 17
- Version(s):
- BigQuery JDBC driver (Simba-based, JDBC 4.2, Google-distributed)
- Tested with the latest available driver at time of writing
Steps to reproduce
- Create or subscribe to a dataset using BigQuery Analytics Hub (linked dataset).
- Connect to BigQuery using the BigQuery JDBC driver.
- Call JDBC metadata discovery:
DatabaseMetaData meta = connection.getMetaData(); meta.getTables(null, "<linked_dataset>", null, null);
Code example
Connection conn = DriverManager.getConnection(jdbcUrl);
DatabaseMetaData meta = conn.getMetaData();
meta.getTables(null, "<linked_dataset>", null, null);Stack trace
Error fetching metadata.
Cause: java.lang.NullPointerException
Cannot invoke "java.lang.Boolean.booleanValue()" because
the return value of
"com.google.api.services.bigquery.model.TableList$Tables$View.getUseLegacySql()"
is null
at com.simba.googlebigquery.jdbc42.BQS42DatabaseMetaData.createMetaDataResult(...)
External references such as API reference guides
BigQuery JDBC driver documentation
https://cloud.google.com/bigquery/docs/reference/odbc-jdbc-drivers
BigQuery INFORMATION_SCHEMA (works correctly in this scenario)
https://cloud.google.com/bigquery/docs/information-schema-tables
Related issue (general JDBC metadata discussion):
https://github.com/googleapis/google-cloud-java/issues/2477
Any additional information below
This issue is not related to permissions or IAM.
Using the same service account:
SQL queries against tables/views work
Queries against project.dataset.INFORMATION_SCHEMA.TABLES work
The failure only occurs when using JDBC metadata discovery (getTables).
The same code works when using a normal (non-linked) BigQuery dataset.
This impacts tools that rely on JDBC metadata discovery (e.g. visual schema browsers), while SQL-based access works correctly.