Skip to content

Instantly share code, notes, and snippets.

@tommylees112
Created December 21, 2024 21:43
Show Gist options
  • Save tommylees112/c2ac9cd782c7d62f6719a5dd39e0330a to your computer and use it in GitHub Desktop.
Save tommylees112/c2ac9cd782c7d62f6719a5dd39e0330a to your computer and use it in GitHub Desktop.
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