Skip to content

Instantly share code, notes, and snippets.

@press0
Created May 7, 2021 03:59
Show Gist options
  • Save press0/66530580ec2fa62907c841cbc099065f to your computer and use it in GitHub Desktop.
Save press0/66530580ec2fa62907c841cbc099065f to your computer and use it in GitHub Desktop.
wrangl
import awswrangler as wr
import pandas as pd
df = pd.DataFrame({"id": [1, 2], "value": ["foo1", "boo1"]})
print(df)
bucketPath = 's3://press0-test/awswrangler/'
database="awswrangler"
table="awswrangler_table1"
# Storing data on Data Lake
wr.s3.to_parquet(
df=df,
path=bucketPath,
dataset=True,
database=database,
table=table
)
# Retrieving the data directly from Amazon S3
df = wr.s3.read_parquet(bucketPath, dataset=True)
print(df)
# Retrieving the data from Amazon Athena
df = wr.athena.read_sql_query("SELECT * FROM " + table, database=database)
print(df)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment