You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Athena's Managed Query Results (GA 2025-06) lets a workgroup store query results in Athena-owned storage instead of a user-managed S3 bucket. When a workgroup has ManagedQueryResultsConfiguration.Enabled = true, callers do not need to pass an OutputLocation (and indeed cannot — workgroups with managed results reject ResultConfiguration.OutputLocation).
PyAthena currently always requires s3_staging_dir (or workgroup-overridden OutputLocation) to construct the ResultConfiguration for StartQueryExecution. This blocks users on managed-results workgroups.
Proposed change
Relax the s3_staging_dir requirement in Connection.__init__ / BaseCursor when the workgroup uses managed results. The simplest path is to allow s3_staging_dir=None and skip ResultConfiguration.OutputLocation in the request when not provided. Athena will respond with an error if the workgroup actually requires one.
Reference: result_reuse_enabled / result_reuse_minutes is the existing precedent for an opt-in feature flowing through Connection -> BaseCursor._build_start_query_execution_request (see pyathena/common.py:208).
Out of scope
Workgroup creation / management (not part of PyAthena's surface).
Reading results from managed storage — GetQueryResults works transparently in both modes.
Summary
Athena's Managed Query Results (GA 2025-06) lets a workgroup store query results in Athena-owned storage instead of a user-managed S3 bucket. When a workgroup has
ManagedQueryResultsConfiguration.Enabled = true, callers do not need to pass anOutputLocation(and indeed cannot — workgroups with managed results rejectResultConfiguration.OutputLocation).PyAthena currently always requires
s3_staging_dir(or workgroup-overriddenOutputLocation) to construct theResultConfigurationforStartQueryExecution. This blocks users on managed-results workgroups.Proposed change
s3_staging_dirrequirement inConnection.__init__/BaseCursorwhen the workgroup uses managed results. The simplest path is to allows3_staging_dir=Noneand skipResultConfiguration.OutputLocationin the request when not provided. Athena will respond with an error if the workgroup actually requires one.AthenaQueryExecution.managed_query_results_enabledproperty added in Add support for newer GetQueryExecution response fields in AthenaQueryExecution #707 / feat: support newer GetQueryExecution response fields #708 for observability.Reference:
result_reuse_enabled/result_reuse_minutesis the existing precedent for an opt-in feature flowing throughConnection->BaseCursor._build_start_query_execution_request(seepyathena/common.py:208).Out of scope
GetQueryResultsworks transparently in both modes.References