awswrangler/athena/_read.py
def _resolve_query_without_cache(
    # pylint: disable=too-many-branches,too-many-locals,too-many-return-statements,too-many-statements
    sql: str,
    database: str,
    data_source: Optional[str],
    ctas_approach: bool,
    categories: Optional[List[str]],
    chunksize: Union[int, bool, None],
    s3_output: Optional[str],
    workgroup: Optional[str],
    encryption: Optional[str],
    kms_key: Optional[str],
    keep_files: bool,
    ctas_database_name: Optional[str],
    ctas_temp_table_name: Optional[str],
    ctas_bucketing_info: Optional[Tuple[List[str], int]],
    use_threads: Union[bool, int],
    s3_additional_kwargs: Optional[Dict[str, Any]],
    boto3_session: boto3.Session,
    pyarrow_additional_kwargs: Optional[Dict[str, Any]] = None,
) -> Union[pd.DataFrame, Iterator[pd.DataFrame]]:
    """
    Execute a query in Athena and returns results as DataFrame, back to `read_sql_query`.

    Usually called by `read_sql_query` when using cache is not possible.
    """
    wg_config: _WorkGroupConfig = _get_workgroup_config(session=boto3_session, workgroup=workgroup)
    _s3_output: str = _get_s3_output(s3_output=s3_output, wg_config=wg_config, boto3_session=boto3_session)
    _s3_output = _s3_output[:-1] if _s3_output[-1] == "/" else _s3_output
    if ctas_approach is True:
        if ctas_temp_table_name is not None:
            name: str = catalog.sanitize_table_name(ctas_temp_table_name)
        else:
            name = f"temp_table_{uuid.uuid4().hex}"
        try:
            return _resolve_query_without_cache_ctas(
                sql=sql,
                database=database,
                data_source=data_source,
                s3_output=_s3_output,
                keep_files=keep_files,
                chunksize=chunksize,
                categories=categories,
                encryption=encryption,
                workgroup=workgroup,
                kms_key=kms_key,
                wg_config=wg_config,
                alt_database=ctas_database_name,
                name=name,
                ctas_bucketing_info=ctas_bucketing_info,
                use_threads=use_threads,
                s3_additional_kwargs=s3_additional_kwargs,
                boto3_session=boto3_session,
                pyarrow_additional_kwargs=pyarrow_additional_kwargs,
            )
        finally:
            catalog.delete_table_if_exists(
                database=ctas_database_name or database, table=name, boto3_session=boto3_session
            )
    return _resolve_query_without_cache_regular(
        sql=sql,
        database=database,
        data_source=data_source,
        s3_output=_s3_output,
        keep_files=keep_files,
        chunksize=chunksize,
        categories=categories,
        encryption=encryption,
        workgroup=workgroup,
        kms_key=kms_key,
        wg_config=wg_config,
        use_threads=use_threads,
        s3_additional_kwargs=s3_additional_kwargs,
        boto3_session=boto3_session,
    )

    Execute a query in Athena and returns results as DataFrame, back to `read_sql_query`.

    Usually called by `read_sql_query` when using cache is not possible.
    
Execute a query in Athena and returns results as DataFrame, back to `read_sql_query`.
Usually called by `read_sql_query` when using cache is not possible.
Execute a query in Athena and returns results as DataFrame back to ` read_sql_query ` . Usually called by ` read_sql_query ` when using cache is not possible .
def _resolve_query_without_cache(
    sql: str,
    database: str,
    data_source: Optional[str],
    ctas_approach: bool,
    categories: Optional[List[str]],
    chunksize: Union[int, bool, None],
    s3_output: Optional[str],
    workgroup: Optional[str],
    encryption: Optional[str],
    kms_key: Optional[str],
    keep_files: bool,
    ctas_database_name: Optional[str],
    ctas_temp_table_name: Optional[str],
    ctas_bucketing_info: Optional[Tuple[List[str], int]],
    use_threads: Union[bool, int],
    s3_additional_kwargs: Optional[Dict[str, Any]],
    boto3_session: boto3.Session,
    pyarrow_additional_kwargs: Optional[Dict[str, Any]] = None,
) -> Union[pd.DataFrame, Iterator[pd.DataFrame]]:
    wg_config: _WorkGroupConfig = _get_workgroup_config(session=boto3_session, workgroup=workgroup)
    _s3_output: str = _get_s3_output(s3_output=s3_output, wg_config=wg_config, boto3_session=boto3_session)
    _s3_output = _s3_output[:-1] if _s3_output[-1] == "/" else _s3_output
    if ctas_approach is True:
        if ctas_temp_table_name is not None:
            name: str = catalog.sanitize_table_name(ctas_temp_table_name)
        else:
            name = f"temp_table_{uuid.uuid4().hex}"
        try:
            return _resolve_query_without_cache_ctas(
                sql=sql,
                database=database,
                data_source=data_source,
                s3_output=_s3_output,
                keep_files=keep_files,
                chunksize=chunksize,
                categories=categories,
                encryption=encryption,
                workgroup=workgroup,
                kms_key=kms_key,
                wg_config=wg_config,
                alt_database=ctas_database_name,
                name=name,
                ctas_bucketing_info=ctas_bucketing_info,
                use_threads=use_threads,
                s3_additional_kwargs=s3_additional_kwargs,
                boto3_session=boto3_session,
                pyarrow_additional_kwargs=pyarrow_additional_kwargs,
            )
        finally:
            catalog.delete_table_if_exists(
                database=ctas_database_name or database, table=name, boto3_session=boto3_session
            )
    return _resolve_query_without_cache_regular(
        sql=sql,
        database=database,
        data_source=data_source,
        s3_output=_s3_output,
        keep_files=keep_files,
        chunksize=chunksize,
        categories=categories,
        encryption=encryption,
        workgroup=workgroup,
        kms_key=kms_key,
        wg_config=wg_config,
        use_threads=use_threads,
        s3_additional_kwargs=s3_additional_kwargs,
        boto3_session=boto3_session,
    )
def _resolve_query_without_cache ( sql : str , database : str , data_source : Optional [ str ] , ctas_approach : bool , categories : Optional [ List [ str ] ] , chunksize : Union [ int , bool , None ] , s3_output : Optional [ str ] , workgroup : Optional [ str ] , encryption : Optional [ str ] , kms_key : Optional [ str ] , keep_files : bool , ctas_database_name : Optional [ str ] , ctas_temp_table_name : Optional [ str ] , ctas_bucketing_info : Optional [ Tuple [ List [ str ] , int ] ] , use_threads : Union [ bool , int ] , s3_additional_kwargs : Optional [ Dict [ str , Any ] ] , boto3_session : boto3 . Session , pyarrow_additional_kwargs : Optional [ Dict [ str , Any ] ] = None , ) -> Union [ pd . DataFrame , Iterator [ pd . DataFrame ] ] : wg_config : _WorkGroupConfig = _get_workgroup_config ( session = boto3_session , workgroup = workgroup ) _s3_output : str = _get_s3_output ( s3_output = s3_output , wg_config = wg_config , boto3_session = boto3_session ) _s3_output = _s3_output [ : - 1 ] if _s3_output [ - 1 ] == "/" else _s3_output if ctas_approach is True : if ctas_temp_table_name is not None : name : str = catalog . sanitize_table_name ( ctas_temp_table_name ) else : name = f"temp_table_{uuid.uuid4().hex}" try : return _resolve_query_without_cache_ctas ( sql = sql , database = database , data_source = data_source , s3_output = _s3_output , keep_files = keep_files , chunksize = chunksize , categories = categories , encryption = encryption , workgroup = workgroup , kms_key = kms_key , wg_config = wg_config , alt_database = ctas_database_name , name = name , ctas_bucketing_info = ctas_bucketing_info , use_threads = use_threads , s3_additional_kwargs = s3_additional_kwargs , boto3_session = boto3_session , pyarrow_additional_kwargs = pyarrow_additional_kwargs , ) finally : catalog . delete_table_if_exists ( database = ctas_database_name or database , table = name , boto3_session = boto3_session ) return _resolve_query_without_cache_regular ( sql = sql , database = database , data_source = data_source , s3_output = _s3_output , keep_files = keep_files , chunksize = chunksize , categories = categories , encryption = encryption , workgroup = workgroup , kms_key = kms_key , wg_config = wg_config , use_threads = use_threads , s3_additional_kwargs = s3_additional_kwargs , boto3_session = boto3_session , )
Execute a query in Athena and returns results as DataFrame, back to `read_sql_query`.
Execute a query in Athena and returns results as DataFrame back to ` read_sql_query ` .
# pylint: disable=too-many-branches,too-many-locals,too-many-return-statements,too-many-statements """
    Execute a query in Athena and returns results as DataFrame, back to `read_sql_query`.

    Usually called by `read_sql_query` when using cache is not possible.
    """
sql
str
database
str
data_source
Optional[str]
ctas_approach
bool
categories
Optional[List[str]]
chunksize
Union[int, bool, None]
s3_output
Optional[str]
workgroup
Optional[str]
encryption
Optional[str]
kms_key
Optional[str]
keep_files
bool
ctas_database_name
Optional[str]
ctas_temp_table_name
Optional[str]
ctas_bucketing_info
Optional[Tuple[List[str], int]]
use_threads
Union[bool, int]
s3_additional_kwargs
Optional[Dict[str, Any]]
boto3_session
boto3.Session
pyarrow_additional_kwargs
Optional[Dict[str, Any]]