@@ -320,6 +320,7 @@ def _resolve_query_without_cache_ctas(
320320 boto3_session : boto3 .Session | None ,
321321 pyarrow_additional_kwargs : dict [str , Any ] | None = None ,
322322 execution_params : list [str ] | None = None ,
323+ result_reuse_configuration : dict [str , Any ] | None = None ,
323324 dtype_backend : Literal ["numpy_nullable" , "pyarrow" ] = "numpy_nullable" ,
324325) -> pd .DataFrame | Iterator [pd .DataFrame ]:
325326 ctas_query_info : dict [str , str | _QueryMetadata ] = create_ctas_table (
@@ -339,6 +340,7 @@ def _resolve_query_without_cache_ctas(
339340 boto3_session = boto3_session ,
340341 params = execution_params ,
341342 paramstyle = "qmark" ,
343+ result_reuse_configuration = result_reuse_configuration ,
342344 )
343345 fully_qualified_name : str = f'"{ ctas_query_info ["ctas_database" ]} "."{ ctas_query_info ["ctas_table" ]} "'
344346 ctas_query_metadata = cast (_QueryMetadata , ctas_query_info ["ctas_query_metadata" ])
@@ -378,6 +380,7 @@ def _resolve_query_without_cache_unload(
378380 boto3_session : boto3 .Session | None ,
379381 pyarrow_additional_kwargs : dict [str , Any ] | None = None ,
380382 execution_params : list [str ] | None = None ,
383+ result_reuse_configuration : dict [str , Any ] | None = None ,
381384 dtype_backend : Literal ["numpy_nullable" , "pyarrow" ] = "numpy_nullable" ,
382385) -> pd .DataFrame | Iterator [pd .DataFrame ]:
383386 query_metadata = _unload (
@@ -395,6 +398,7 @@ def _resolve_query_without_cache_unload(
395398 data_source = data_source ,
396399 athena_query_wait_polling_delay = athena_query_wait_polling_delay ,
397400 execution_params = execution_params ,
401+ result_reuse_configuration = result_reuse_configuration ,
398402 )
399403 if file_format == "PARQUET" :
400404 return _fetch_parquet_result (
@@ -427,6 +431,7 @@ def _resolve_query_without_cache_regular(
427431 s3_additional_kwargs : dict [str , Any ] | None ,
428432 boto3_session : boto3 .Session | None ,
429433 execution_params : list [str ] | None = None ,
434+ result_reuse_configuration : dict [str , Any ] | None = None ,
430435 dtype_backend : Literal ["numpy_nullable" , "pyarrow" ] = "numpy_nullable" ,
431436 client_request_token : str | None = None ,
432437) -> pd .DataFrame | Iterator [pd .DataFrame ]:
@@ -444,6 +449,7 @@ def _resolve_query_without_cache_regular(
444449 encryption = encryption ,
445450 kms_key = kms_key ,
446451 execution_params = execution_params ,
452+ result_reuse_configuration = result_reuse_configuration ,
447453 client_request_token = client_request_token ,
448454 boto3_session = boto3_session ,
449455 )
@@ -467,7 +473,7 @@ def _resolve_query_without_cache_regular(
467473 )
468474
469475
470- def _resolve_query_without_cache (
476+ def _resolve_query_without_cache ( # noqa: PLR0913
471477 sql : str ,
472478 database : str ,
473479 data_source : str | None ,
@@ -491,6 +497,7 @@ def _resolve_query_without_cache(
491497 boto3_session : boto3 .Session | None ,
492498 pyarrow_additional_kwargs : dict [str , Any ] | None = None ,
493499 execution_params : list [str ] | None = None ,
500+ result_reuse_configuration : dict [str , Any ] | None = None ,
494501 dtype_backend : Literal ["numpy_nullable" , "pyarrow" ] = "numpy_nullable" ,
495502 client_request_token : str | None = None ,
496503) -> pd .DataFrame | Iterator [pd .DataFrame ]:
@@ -526,6 +533,7 @@ def _resolve_query_without_cache(
526533 boto3_session = boto3_session ,
527534 pyarrow_additional_kwargs = pyarrow_additional_kwargs ,
528535 execution_params = execution_params ,
536+ result_reuse_configuration = result_reuse_configuration ,
529537 dtype_backend = dtype_backend ,
530538 )
531539 finally :
@@ -554,6 +562,7 @@ def _resolve_query_without_cache(
554562 boto3_session = boto3_session ,
555563 pyarrow_additional_kwargs = pyarrow_additional_kwargs ,
556564 execution_params = execution_params ,
565+ result_reuse_configuration = result_reuse_configuration ,
557566 dtype_backend = dtype_backend ,
558567 )
559568 return _resolve_query_without_cache_regular (
@@ -572,6 +581,7 @@ def _resolve_query_without_cache(
572581 s3_additional_kwargs = s3_additional_kwargs ,
573582 boto3_session = boto3_session ,
574583 execution_params = execution_params ,
584+ result_reuse_configuration = result_reuse_configuration ,
575585 dtype_backend = dtype_backend ,
576586 client_request_token = client_request_token ,
577587 )
@@ -592,6 +602,7 @@ def _unload(
592602 data_source : str | None ,
593603 athena_query_wait_polling_delay : float ,
594604 execution_params : list [str ] | None ,
605+ result_reuse_configuration : dict [str , Any ] | None = None ,
595606) -> _QueryMetadata :
596607 wg_config : _WorkGroupConfig = _get_workgroup_config (session = boto3_session , workgroup = workgroup )
597608 s3_output : str = _get_s3_output (s3_output = path , wg_config = wg_config , boto3_session = boto3_session )
@@ -624,6 +635,7 @@ def _unload(
624635 kms_key = kms_key ,
625636 boto3_session = boto3_session ,
626637 execution_params = execution_params ,
638+ result_reuse_configuration = result_reuse_configuration ,
627639 )
628640 except botocore .exceptions .ClientError as ex :
629641 msg : str = str (ex )
@@ -1104,6 +1116,7 @@ def read_sql_query(
11041116 boto3_session = boto3_session ,
11051117 pyarrow_additional_kwargs = pyarrow_additional_kwargs ,
11061118 execution_params = execution_params ,
1119+ result_reuse_configuration = cache_info .result_reuse_configuration ,
11071120 dtype_backend = dtype_backend ,
11081121 client_request_token = client_request_token ,
11091122 )
@@ -1371,6 +1384,7 @@ def unload(
13711384 data_source : str | None = None ,
13721385 params : dict [str , Any ] | list [str ] | None = None ,
13731386 paramstyle : Literal ["qmark" , "named" ] = "named" ,
1387+ result_reuse_configuration : dict [str , Any ] | None = None ,
13741388 athena_query_wait_polling_delay : float = _QUERY_WAIT_POLLING_DELAY ,
13751389) -> _QueryMetadata :
13761390 """Write query results from a SELECT statement to the specified data format using UNLOAD.
@@ -1459,4 +1473,5 @@ def unload(
14591473 boto3_session = boto3_session ,
14601474 data_source = data_source ,
14611475 execution_params = execution_params ,
1476+ result_reuse_configuration = result_reuse_configuration ,
14621477 )
0 commit comments