Created
December 21, 2024 21:43
-
-
Save tommylees112/c2ac9cd782c7d62f6719a5dd39e0330a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
if __name__ == "__main__": | |
s3_client = boto3.client("s3") | |
bucket_name = BUCKET_NAME | |
object_key = "cpi_adjusted_2023.csv" | |
file_name = (downloads / "cpi_adjusted_2023.csv").expanduser().resolve().as_posix() | |
# Upload file with proper metadata | |
s3_client.upload_file( | |
Filename=file_name, | |
Bucket=bucket_name, | |
Key=object_key, | |
ExtraArgs={ | |
"ContentType": "text/csv", # Correct content type for S3 Select | |
"Metadata": { | |
"description": "CPI Correction factor adjusted for 2023", | |
"source": "ONS", | |
}, | |
}, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment