From 8bd4a7b524231e9c06cfa9d32fb1d3a1de17c262 Mon Sep 17 00:00:00 2001 From: ryan-szns Date: Wed, 8 Oct 2025 10:23:52 -0400 Subject: [PATCH 1/2] Allow for multiple tables from the same BigQuery dataset --- app_pages/agents.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app_pages/agents.py b/app_pages/agents.py index b0d28e9f..f6347794 100644 --- a/app_pages/agents.py +++ b/app_pages/agents.py @@ -101,7 +101,7 @@ def agents_main(): if data_source == BIG_QUERY: bq_project_id = st.text_input("BigQuery project ID:", placeholder="bigquery-public-data") bq_dataset_id = st.text_input("BigQuery dataset ID:", placeholder="san_francisco_trees") - bq_table_id = st.text_input("BigQuery table ID:",placeholder="street_trees") + bq_table_ids = st.text_area("BigQuery table IDs (comma-separated):",placeholder="street_trees, another_table") else: looker_instance_url=st.text_input("Looker instance URL:", placeholder="myinstance.looker.com") @@ -120,11 +120,15 @@ def agents_main(): published_context = geminidataanalytics.Context() datasource_references = geminidataanalytics.DatasourceReferences() if data_source == BIG_QUERY: - bigquery_table_reference = geminidataanalytics.BigQueryTableReference() - bigquery_table_reference.project_id = bq_project_id - bigquery_table_reference.dataset_id = bq_dataset_id - bigquery_table_reference.table_id = bq_table_id - datasource_references.bq.table_references = [bigquery_table_reference] + table_references = [] + for table_id in [id.strip() for id in bq_table_ids.split(',')]: + if table_id: + bigquery_table_reference = geminidataanalytics.BigQueryTableReference() + bigquery_table_reference.project_id = bq_project_id + bigquery_table_reference.dataset_id = bq_dataset_id + bigquery_table_reference.table_id = table_id + table_references.append(bigquery_table_reference) + datasource_references.bq.table_references = table_references else: looker_explore_reference = geminidataanalytics.LookerExploreReference() looker_explore_reference.looker_instance_uri = looker_instance_url From 4c57cbd62f47ea1b8183ee0bb4732d06d96862a5 Mon Sep 17 00:00:00 2001 From: ryan-szns Date: Wed, 8 Oct 2025 11:17:23 -0400 Subject: [PATCH 2/2] More pythonic BigQueryTableReference appending Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- app_pages/agents.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app_pages/agents.py b/app_pages/agents.py index f6347794..8a32346f 100644 --- a/app_pages/agents.py +++ b/app_pages/agents.py @@ -120,14 +120,15 @@ def agents_main(): published_context = geminidataanalytics.Context() datasource_references = geminidataanalytics.DatasourceReferences() if data_source == BIG_QUERY: - table_references = [] - for table_id in [id.strip() for id in bq_table_ids.split(',')]: - if table_id: - bigquery_table_reference = geminidataanalytics.BigQueryTableReference() - bigquery_table_reference.project_id = bq_project_id - bigquery_table_reference.dataset_id = bq_dataset_id - bigquery_table_reference.table_id = table_id - table_references.append(bigquery_table_reference) + table_ids = [tid.strip() for tid in bq_table_ids.split(',') if tid.strip()] + table_references = [ + geminidataanalytics.BigQueryTableReference( + project_id=bq_project_id, + dataset_id=bq_dataset_id, + table_id=tid, + ) + for tid in table_ids + ] datasource_references.bq.table_references = table_references else: looker_explore_reference = geminidataanalytics.LookerExploreReference()