I am doing a Python script that runs a query on AWS Athena in AWS Lambda. The result are sent to my s3 bucket as csv and metadata files. Here is the script :
def lambda_handler(event, context):
client = boto3.client('athena')
QueryResponse = client.start_query_execution(
QueryString = "SELECT id from campaign;",
QueryExecutionContext = {
'Database' : 'raw'
},
ResultConfiguration = {
'OutputLocation' : 's3://my-bucket-name'
}
)
#Oberserve results :
queryId = QueryResponse['QueryExecutionId']
time.sleep(10)
results = client.get_query_results(QueryExecutionId = queryId)
for row in results['ResultSet']['Rows']:
print(row)
The code works fine, but I would like to choose the name of the resulting csv file in s3. Any ideas on how I could do that ?
Thank's for helping.