Skip to content

Restore legacy keyword arguments on the private _execute() methods#735

Merged
laughingman7743 merged 2 commits into
masterfrom
fix/734-execute-legacy-kwargs
Jul 10, 2026
Merged

Restore legacy keyword arguments on the private _execute() methods#735
laughingman7743 merged 2 commits into
masterfrom
fix/734-execute-legacy-kwargs

Conversation

@laughingman7743

Copy link
Copy Markdown
Member

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) on BaseCursor._execute() and AioBaseCursor._execute(). The keywords are merged into ExecuteOptions via the existing ExecuteOptions.resolve() (individual keywords win, None values 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 reported TypeError on 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 public execute() (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:

TypeError: BaseCursor._execute() got an unexpected keyword argument 'work_group'

Closes #734. Reported upstream in dbt-labs/dbt-adapters#2052.

Notes:

  • The v3.34 parameter order is restored with options appended 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.
  • Will be released as v3.35.1.

🤖 Generated with Claude Code

laughingman7743 and others added 2 commits July 11, 2026 00:44
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>
@laughingman7743 laughingman7743 marked this pull request as ready for review July 10, 2026 16:38
@laughingman7743 laughingman7743 merged commit c32fc58 into master Jul 10, 2026
15 checks passed
@laughingman7743 laughingman7743 deleted the fix/734-execute-legacy-kwargs branch July 10, 2026 16:41
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.

Backwards incompatible changes in 3.35 breaks dbt projects

1 participant