Skip to content

Commit c1d3b2d

Browse files
authored
Handle None destination for procedural queries in execute_sql
1 parent cac9fae commit c1d3b2d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/google/adk/tools/bigquery/query_tool.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,14 @@ def execute_sql(
194194
connection_properties=bq_connection_properties,
195195
),
196196
)
197+
destination_dataset_id = None
198+
if dry_run_query_job.destination:
199+
destination_dataset_id = dry_run_query_job.destination.dataset_id
200+
197201
if (
198202
dry_run_query_job.statement_type != "SELECT"
199-
and dry_run_query_job.destination.dataset_id != bq_session_dataset_id
203+
and destination_dataset_id != bq_session_dataset_id
204+
and destination_dataset_id is not None
200205
):
201206
return {
202207
"status": "ERROR",

0 commit comments

Comments
 (0)