dbx icon indicating copy to clipboard operation
dbx copied to clipboard

[Bug] BigQuery: expanding a dataset fails to load tables — dataset name overwrites ProjectId in metadata pool

Open thangnc0101 opened this issue 1 week ago • 2 comments

数据库类型和版本 / Database type and version

Google BigQuery (Simba JDBC 1.8.3.1002)

问题描述 / Problem description

Summary / 摘要: BigQuery connection lists datasets fine, but expanding any dataset never loads its tables. The per-database metadata pool overwrites ConnectionConfig.database (= BigQuery ProjectId) with the dataset name, so the agent reconnects with ProjectId=<dataset> and BigQuery rejects it. BigQuery 连接可以列出 dataset,但展开 dataset 时无法加载表:元数据连接池把 dataset 名覆盖到了 database(即 ProjectId)字段。

1. Steps

  1. Create a BigQuery connection: Project ID = my-project, URL params = OAuthType=0;OAuthServiceAcctEmail=...;OAuthPvtKeyPath=...;Location=asia-southeast1 (Simba JDBC 1.8.3.1002).
  2. Connect → dataset list loads correctly (e.g. my_dataset).
  3. Expand my_dataset → Tables.

2. Expected

Tables of my_dataset are listed.

3. Actual

Tables never load. Calling the BigQuery agent (agent.jar 0.1.95) directly with the same connect params as the metadata pool reproduces it:

connect {"database":"my_dataset", ...}
=> java.sql.SQLException: [Simba][BigQueryJDBCDriver](100004) HttpTransport IO error : 400 Bad Request
POST https://bigquery.googleapis.com/bigquery/v2/projects/my_dataset/jobs
"Invalid project ID 'my_dataset'. Project IDs must contain 6-63 lowercase letters, digits, or dashes..."

With database = the real project id, both list_databases and list_tables {"schema":"my_dataset"} work fine, so the agent itself is OK.

Root cause

crates/dbx-core/src/connection/mod.rs → database_connection_config_with_catalog:

if let Some(db) = database {
    if !matches!(
        db_config.db_type,
        DatabaseType::Oracle | DatabaseType::Dameng | DatabaseType::MongoDb
            | DatabaseType::OceanbaseOracle | DatabaseType::CloudflareD1
    ) {
        db_config.database = Some(db.to_string());   // BigQuery: dataset -> ProjectId
    }
}

list_tables_once → get_or_create_metadata_pool_for_session(connection_id, Some(database)) passes the dataset name, and BigQueryAgent.buildUrl uses params.getDatabase() as ProjectId, producing jdbc:bigquery://...;ProjectId=my_dataset.

Suggested fix

Add DatabaseType::Bigquery to the exclusion list above (datasets are addressed via the schema parameter / `dataset`.INFORMATION_SCHEMA.TABLES anyway). Possibly also review metadata_pool_database so BigQuery reuses the connection-level pool.

Workaround for now: query with fully-qualified names in the SQL editor (`my-project.my_dataset.table`).

支持信息 / Support information

DBX 版本 / Version: 0.6.72-beta.20261119.2 运行环境 / Runtime: Desktop 操作系统 / OS: macOS 26.5.1 系统架构 / Architecture: aarch64 BigQuery agent: 0.1.95 (JRE 21), Simba BigQuery JDBC 1.8.3.1002

优先级(是否紧急) / Priority (urgency)

🟠 P1 重要 · 尽快处理 / Important · Fix soon

补充信息 / Additional information

No response

thangnc0101 avatar Nov 25 '26 07:11 thangnc0101

/claim

imcman avatar Nov 25 '26 09:11 imcman

✅ @imcman 已认领 #15680,开始处理吧!

dbx-bot[bot] avatar Nov 25 '26 09:11 dbx-bot[bot]