-
Notifications
You must be signed in to change notification settings - Fork 8
fix: use-server-side-cursor is not working #746
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?
Conversation
📜 Docstring Coverage ReportRESULT: PASSED (minimum: 30.0%, actual: 75.8%) Detailed Coverage Report
|
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.
Pull Request Overview
This PR fixes an issue where the use-server-side-cursor
configuration was being ignored in SQL query execution. The fix ensures that when server-side cursors are enabled, database connections are properly configured to use them with appropriate batch sizing.
- Added server-side cursor configuration to SQL query execution
- Imported the
USE_SERVER_SIDE_CURSOR
constant to check cursor settings - Applied execution options with
yield_per=100000
when server-side cursors are enabled
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
if USE_SERVER_SIDE_CURSOR: | ||
conn = conn.execution_options(yield_per=100000) |
Copilot
AI
Sep 30, 2025
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.
The magic number 100000 for yield_per should be extracted to a named constant or made configurable. This hardcoded value makes it difficult to tune performance for different use cases.
Copilot uses AI. Check for mistakes.
📦 Trivy Vulnerability Scan Results
Report Summary
Scan Result Details✅ No vulnerabilities found during the scan for |
📦 Trivy Secret Scan Results
Report Summary
Scan Result Details✅ No secrets found during the scan for |
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified FilesNo covered modified files...
|
🛠 Full Test Coverage Report: https://k.atlan.dev/coverage/application-sdk/pr/746 |
""" | ||
with self.engine.connect() as conn: | ||
if USE_SERVER_SIDE_CURSOR: | ||
conn = conn.execution_options(yield_per=100000) |
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.
Bug: Server-Side Cursor Inconsistency and Yield Per Issue
Server-side cursor configuration is only applied in _execute_query
, not _read_sql_query
. This prevents async database connections from using server-side cursors, creating inconsistent behavior when USE_SERVER_SIDE_CURSOR
is enabled. Additionally, the hardcoded yield_per=100000
value doesn't align with self.chunk_size
, which could impact performance or memory.
🛠 Docs available at: https://k.atlan.dev/application-sdk/fix-use-server-side-cursor |
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.
- use a lower number which is set as buffer size in case of SqlQueryInput
- Use is across all querying methods (check cursor comment)
Changelog
Additional context (e.g. screenshots, logs, links)
Checklist
Copyleft License Compliance
Note
Respect
USE_SERVER_SIDE_CURSOR
to execute queries withyield_per=100000
, avoiding full in-memory fetches.application_sdk/inputs/sql_query.py
):USE_SERVER_SIDE_CURSOR
and, when enabled, setconn.execution_options(yield_per=100000)
before running pandas read, enabling server-side cursor/batched fetching.Written by Cursor Bugbot for commit f992d89. This will update automatically on new commits. Configure here.