Extract shared boilerplate from sync cursors into WithFetch mixin#676
Merged
laughingman7743 merged 1 commit intomasterfrom Feb 21, 2026
Merged
Extract shared boilerplate from sync cursors into WithFetch mixin#676laughingman7743 merged 1 commit intomasterfrom
laughingman7743 merged 1 commit intomasterfrom
Conversation
Add WithFetch class to result_set.py as the sync counterpart to WithAsyncFetch, consolidating ~500 lines of duplicated properties, lifecycle methods, and fetch methods from 5 sync cursor types. Closes #669 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
WithFetchmixin topyathena/result_set.py— the sync counterpart toWithAsyncFetch— consolidating shared properties (arraysize,result_set,query_id,rownumber,rowcount), lifecycle methods (close(),executemany(),cancel()), and fetch methods (fetchone(),fetchmany(),fetchall()) into a single base classCursor,PandasCursor,ArrowCursor,PolarsCursor, andS3FSCursorto inherit fromWithFetchinstead of the triple(BaseCursor, CursorIterator, WithResultSet), removing ~500 lines of duplicated codeasync_cursor.pyimport to use canonicalpyathena.common.BaseCursorpathDesign decisions
result_set.py: Avoids circular import (common.py→result_set.py→common.py) sinceresult_set.pyalready importsCursorIteratorfromcommon.pyarraysizevalidation (value <= 0only) inWithFetch, matchingWithAsyncFetch—CursorandAioCursoroverride with strict validation (value > DEFAULT_FETCH_SIZE)SparkCursor(different execution model), async cursors (separate concern), aio cursors (already deduplicated viaWithAsyncFetch)Closes #669
Test plan
make fmt— formatting cleanmake chk— ruff lint + mypy type checking passmake test— unit tests (requires AWS env)🤖 Generated with Claude Code