Skip to content

Add BigQuery support to evaluation config generation - #194

Open
totoleon wants to merge 3 commits into
mainfrom
feature/bigquery-support
Open

Add BigQuery support to evaluation config generation#194
totoleon wants to merge 3 commits into
mainfrom
feature/bigquery-support

Conversation

@totoleon

Copy link
Copy Markdown
Collaborator

Implements the BigQuery portion of the Wave2 FR:

  • Add BigQueryConfigGenerator mapping tools.yaml bigquery sources to Evalbench db_config and GDA BigQueryTableReferences model config
  • Register the generator in the evaluate_generator factory map
  • Add bigquery.md connection reference template for the init skill
  • Attach agent_context_reference dynamically since the field is not yet in the public GDA SDK (restricted-visibility rollout)

Implements the BigQuery portion of the Wave2 FR:
- Add BigQueryConfigGenerator mapping tools.yaml bigquery sources to
  Evalbench db_config and GDA BigQueryTableReferences model config
- Register the generator in the evaluate_generator factory map
- Add bigquery.md connection reference template for the init skill
- Attach agent_context_reference dynamically since the field is not yet
  in the public GDA SDK (restricted-visibility rollout)
@totoleon
totoleon requested a review from wangauone July 23, 2026 16:51

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new BigQueryConfigGenerator to support BigQuery configuration topologies, along with corresponding reference documentation and unit tests. The review feedback highlights a potential runtime AttributeError when dynamically attaching agent_context_reference if the AgentContextReference class itself is missing from the public SDK, and provides a robust code suggestion to handle this gracefully.

Comment on lines +67 to +77
# The agent_context_reference field on BigQueryTableReferences is not
# yet available in the public google-cloud-geminidataanalytics SDK
# (restricted-visibility rollout; see the Wave2 FR). Attach it
# dynamically so this generator works with internal SDK builds and
# degrades gracefully on public ones.
if "agent_context_reference" in {
f.name for f in type(bq_references).pb(bq_references).DESCRIPTOR.fields
}:
bq_references.agent_context_reference = gda.AgentContextReference(
context_set_id=context_set_id
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

If agent_context_reference is not yet available in the public SDK, it is highly likely that the AgentContextReference class itself is also missing or restricted in that version. Referencing gda.AgentContextReference directly will raise an AttributeError at runtime, defeating the graceful degradation goal.

To make this fully robust, we should dynamically retrieve the class using getattr and check its existence. Additionally, we can use bq_references._pb to access the underlying protobuf message, which is more consistent with how it is done elsewhere in the codebase (e.g., query_context._pb in BaseDBConfigGenerator).

Suggested change
# The agent_context_reference field on BigQueryTableReferences is not
# yet available in the public google-cloud-geminidataanalytics SDK
# (restricted-visibility rollout; see the Wave2 FR). Attach it
# dynamically so this generator works with internal SDK builds and
# degrades gracefully on public ones.
if "agent_context_reference" in {
f.name for f in type(bq_references).pb(bq_references).DESCRIPTOR.fields
}:
bq_references.agent_context_reference = gda.AgentContextReference(
context_set_id=context_set_id
)
# The agent_context_reference field on BigQueryTableReferences is not
# yet available in the public google-cloud-geminidataanalytics SDK
# (restricted-visibility rollout; see the Wave2 FR). Attach it
# dynamically so this generator works with internal SDK builds and
# degrades gracefully on public ones.
agent_context_ref_cls = getattr(gda, "AgentContextReference", None)
if agent_context_ref_cls and "agent_context_reference" in {
f.name for f in bq_references._pb.DESCRIPTOR.fields
}:
bq_references.agent_context_reference = agent_context_ref_cls(
context_set_id=context_set_id
)

@g-lynnzee
g-lynnzee self-requested a review July 23, 2026 16:54
totoleon added 2 commits July 23, 2026 17:51
The init skill's database-type list, the generate_evalbench_configs
tool docstring, and the evaluate skill's per-database references all
enumerate supported types explicitly, so the BigQuery generator was
unreachable from the agent workflows without these updates.
BigQuery connections are scoped to a project with no default dataset at
query time, so SQL referencing bare table names fails with 'Table not
found'. Add BigQuery dialect references (template, facet, value search)
to the context-generation-guide mandating project.dataset.table
qualification, and call the rule out in the dataset-generation drafting
chain of thought.
When tasked with creating new pairs, using the generation plan as the guideline and north star. For *every* generated pair, execute the following internal Chain of Thought:

1. **Draft SQL (Schema-First):** Write syntactically perfect, dialect-compliant SQL using prioritized tables and conditions. Make sure to adhere to the technical schema and generation plan. Avoid inventing columns or tables based on business documents alone.
1. **Draft SQL (Schema-First):** Write syntactically perfect, dialect-compliant SQL using prioritized tables and conditions. Make sure to adhere to the technical schema and generation plan. Avoid inventing columns or tables based on business documents alone. For **BigQuery** sources, every table reference must be fully qualified as `` `project`.`dataset`.`table` `` (taken from the `kind: source` block in `tools.yaml`) — BigQuery has no default dataset at query time, so bare table names fail with "Table not found".

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We try to isolate dialect/product specific things to dedicated dialect files.

Do you need this here or can it go into references/template/bigquery.md used by context-generation-guide?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants