Update outdated BigQuery integration sample code - #2214
Merged
joefernandez merged 2 commits intoSep 10, 2026
Conversation
The BigQuery integration page still imports from google.adk.tools.bigquery, which now raises a DeprecationWarning pointing at google.adk.integrations.bigquery. Update all five auth snippets and the included sample to the new path. The sample also wrapped session_service.create_session() in asyncio.run(), which blows up in Colab and other notebooks where a loop is already running. Restructure it around an async main() that awaits create_session() and iterates runner.run_async(), matching the pattern the other built-in tool snippets already use. Bug: b/559149787
✅ Deploy Preview for adk-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
joefernandez
approved these changes
Sep 10, 2026
joefernandez
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for the update!
joefernandez
enabled auto-merge (squash)
September 10, 2026 15:41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the outdated sample code on the BigQuery integration page, reported in an ADK friction log.
Related task: b/559149787
Deprecated import path
All five auth snippets and the included sample imported from
google.adk.tools.bigquery. That module is now a back-compat shim that emits aDeprecationWarningtelling you to usegoogle.adk.integrations.bigquery:Updated to the new path throughout, including
google.adk.integrations.bigquery.configforBigQueryToolConfig/WriteMode. This matches what the BigQuery sample agent in adk-python already does.asyncio.run()oncreate_session()The sample wrapped the session setup in
asyncio.run(session_service.create_session(...)). That fails withRuntimeError: asyncio.run() cannot be called from a running event loopin Colab and other notebooks, which is where most people first paste this.Restructured around an async
main()that awaitscreate_session()and iteratesrunner.run_async(), with a note about callingawait main()directly in a notebook. This is the same shape the other snippets inexamples/python/snippets/tools/built-in-tools/already use (e.g.google_search.py).Not changed: the model string
The friction log also wondered whether
Agent(model=...)needs agoogle.adk.models.Geminiobject instead of a"gemini-2.5-flash"style string. It doesn't —LLMRegistry.resolve("gemini-2.0-flash")still returnsgoogle.adk.models.google_llm.Gemini, so the string form remains supported. Left as-is.Verification
DeprecationWarning(checked against ADK 2.6.3).BigQueryToolConfig(write_mode=WriteMode.BLOCKED)constructs from the new path.create_session()awaits cleanly, the session is resolvable through the runner, andrun_async()is present.