-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat: Make MAX_DOWNLOADED_QUERY_RESULT_ROWS configurable #2167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: Make MAX_DOWNLOADED_QUERY_RESULT_ROWS configurable #2167
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
- Add max_downloaded_rows field to BigQueryToolConfig with default value 50 - Add optional max_rows parameter to execute_sql function - Parameter takes precedence over config when both provided - Maintain backward compatibility with existing code - Add comprehensive tests for config and parameter functionality - Update truncation logic to use resolved max_downloaded_rows value
35fa798
to
9481f9b
Compare
@@ -175,9 +175,10 @@ def execute_sql( | |||
rows.append(row_values) | |||
|
|||
result = {"status": "SUCCESS", "rows": rows} | |||
max_downloaded_rows = max_rows or (config.max_downloaded_rows if config else 50) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please create a private constant for "50", something like:
_DEFAULT_MAX_DOWNLOADED_QUERY_RESULT_ROWS = 50
That way, we ensure that we have to update the default value (if need be) only at one place and it has a name.
Also, instead of duplicating the logic, please evaluate the value into a single var and reuse the var.
if ( | ||
MAX_DOWNLOADED_QUERY_RESULT_ROWS is not None | ||
and len(rows) == MAX_DOWNLOADED_QUERY_RESULT_ROWS | ||
max_downloaded_rows is not None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears to be a redundant, as we ensure that max_downloaded_rows cannot be None.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Over all the change looks good, left some small comments.
Thank you for contributing.
🤖 Generated with Claude Code