Skip to content

[bigquery][jdbc] DatabaseMetaData.getTables() fails for Analytics Hub linked datasets #11872

@abdusalam2015

Description

@abdusalam2015

[bigquery][jdbc] DatabaseMetaData.getTables() fails for Analytics Hub linked datasets

Thanks for stopping by to let us know something could be better!


Environment details

  1. API: BigQuery (JDBC / metadata discovery)
  2. OS type and version: macOS 14.x (Apple Silicon)
  3. Java version: OpenJDK 17
  4. 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

  1. Create or subscribe to a dataset using BigQuery Analytics Hub (linked dataset).
  2. Connect to BigQuery using the BigQuery JDBC driver.
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions