Created
May 7, 2021 03:59
-
-
Save press0/66530580ec2fa62907c841cbc099065f to your computer and use it in GitHub Desktop.
wrangl
This file contains 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 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