File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
src/google/adk/tools/bigquery Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change 2828from .config import WriteMode
2929
3030BIGQUERY_SESSION_INFO_KEY = "bigquery_session_info"
31+ _DEFAULT_MAX_DOWNLOADED_QUERY_RESULT_ROWS = 50
3132
3233
3334def execute_sql (
@@ -156,11 +157,12 @@ def execute_sql(
156157 if bq_connection_properties
157158 else None
158159 )
160+ max_downloaded_rows = max_rows or (config .max_downloaded_rows if config else _DEFAULT_MAX_DOWNLOADED_QUERY_RESULT_ROWS )
159161 row_iterator = bq_client .query_and_wait (
160162 query ,
161163 job_config = job_config ,
162164 project = project_id ,
163- max_results = max_rows or ( config . max_downloaded_rows if config else 50 ) ,
165+ max_results = max_downloaded_rows ,
164166 )
165167 rows = []
166168 for row in row_iterator :
@@ -175,11 +177,7 @@ def execute_sql(
175177 rows .append (row_values )
176178
177179 result = {"status" : "SUCCESS" , "rows" : rows }
178- max_downloaded_rows = max_rows or (config .max_downloaded_rows if config else 50 )
179- if (
180- max_downloaded_rows is not None
181- and len (rows ) == max_downloaded_rows
182- ):
180+ if len (rows ) == max_downloaded_rows :
183181 result ["result_is_likely_truncated" ] = True
184182 return result
185183 except Exception as ex :
You can’t perform that action at this time.
0 commit comments