Pastebin
Paste #24467: 123
< previous paste - next paste>
Pasted by 123
import boto3 # Connect to the S3 service s3 = boto3.client('s3') # Set the name of the source and destination buckets source_bucket = 'my-source-bucket' destination_bucket = 'my-destination-bucket' # Set the name of the source and destination objects source_object = 'big_data_file.csv' destination_object = 'query_results.csv' # Download the data from the source bucket s3.download_file(source_bucket, source_object, '/tmp/big_data_file.csv') # Open the file and perform the query with open('/tmp/big_data_file.csv', 'r') as f: data = f.read() # Perform the query here query_results = data # Placeholder, replace with actual query # Save the query results to a file with open('/tmp/query_results.csv', 'w') as f: f.write(query_results) # Upload the query results to the destination bucket s3.upload_file('/tmp/query_results.csv', destination_bucket, destination_object)
New Paste
Go to most recent paste.