AWS Athena Query Save As to s3

Viewed 2505

I have a function that takes a query and saves it to an s3 bucket, but it comes as a long and non-meaningful name. Is there a way to set the output file name when saving to s3 via running an Athena query with Boto3? I would like to edit this function to save the output to a specific name on s3.

Here is my code to run an Athena query:

def run_query(query, database, s3_output):    
response = client.start_query_execution(
    QueryString=query,
    QueryExecutionContext={
        'Database': database
        },
    ResultConfiguration={
        'OutputLocation': s3_output,
        }
    )
print('Execution ID: ' + response['QueryExecutionId'])
return response
0 Answers
Related