Skip to content

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

lupuletic
Copy link

  • 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

🤖 Generated with Claude Code

Copy link

google-cla bot commented Jul 24, 2025

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
@lupuletic lupuletic force-pushed the feature/configurable-max-downloaded-rows branch from 35fa798 to 9481f9b Compare July 24, 2025 21:55
@ankursharmas ankursharmas self-requested a review July 26, 2025 00:30
@@ -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)
Copy link
Collaborator

@ankursharmas ankursharmas Jul 26, 2025

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
Copy link
Collaborator

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.

Copy link
Collaborator

@ankursharmas ankursharmas left a 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.

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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy