Restore legacy keyword arguments on the private _execute() methods#735
Merged
Conversation
PR #733 (v3.35.0) consolidated the shared execute() keyword arguments into an ExecuteOptions dataclass and narrowed the private _execute() signature to (operation, parameters, options). External callers that predate ExecuteOptions - most notably dbt-athena <= 1.10.x - call _execute() directly with individual keywords (work_group, s3_staging_dir, cache_size, cache_expiration_time), which now raises: TypeError: BaseCursor._execute() got an unexpected keyword argument 'work_group' Restore the pre-3.35 individual keyword arguments on BaseCursor._execute() and AioBaseCursor._execute(), merging them into ExecuteOptions via the existing ExecuteOptions.resolve() (keywords win, None values are ignored). Closes #734 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add a mocked passthrough test for AioBaseCursor._execute() so the aio compat surface is guarded in CI without AWS credentials, mirroring the synchronous test. Drop the aio live-Athena legacy-kwargs test flagged as redundant in self-review: the mocked test verifies forwarding of all legacy keywords, and the synchronous integration test already proves the dbt-athena call pattern end-to-end. Co-Authored-By: Claude Fable 5 <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.
WHAT
Restore the pre-3.35 individual keyword arguments (
work_group,s3_staging_dir,cache_size,cache_expiration_time,result_reuse_enable,result_reuse_minutes,paramstyle) onBaseCursor._execute()andAioBaseCursor._execute(). The keywords are merged intoExecuteOptionsvia the existingExecuteOptions.resolve()(individual keywords win,Nonevalues are ignored), so the ExecuteOptions consolidation from #733 is otherwise unchanged.Regression tests added:
test_execute_internal_legacy_kwargs(sync, integration): replicates the exact dbt-athena call pattern (_execute()with individual keywords, then_poll()) against real Athena.test_execute_internal_legacy_kwargs_passthrough(sync + aio, no AWS): calls_execute()with all legacy keywords mocked at the API boundary and asserts they are forwarded into the start-query-execution request and the cache lookup. These tests fail with the reportedTypeErroron the v3.35.0 code, so the compat surface is now guarded in CI without AWS credentials.WHY
v3.35.0 (#733) narrowed the private
_execute()signature to(operation, parameters, options). dbt-athena <= 1.10.x bypasses the publicexecute()(which kept full backward compatibility) and calls_execute()directly with individual keywords, so every dbt-athena user resolving to pyathena 3.35.0 fails with:Closes #734. Reported upstream in dbt-labs/dbt-adapters#2052.
Notes:
optionsappended last, so v3.34-era positional callers also keep working. A caller that adopted the one-day-old 3.35.0 signature positionally (_execute(op, params, options)) would misbind; all known external callers pass keywords, and v3.34 compatibility takes priority.🤖 Generated with Claude Code