Home > OS >  How can we write a dataframe to a table in AWS Athena?
How can we write a dataframe to a table in AWS Athena?

Time:09-19

I read through AWS documentation for Pandas, and it seem like you should be able tom write a dataframe to a table in Athena. When I run the code below, I get an error that says 'ValueError: need more than 2 values to unpack'.

import awswrangler as wr
import pandas as pd

df = pd.DataFrame({
"id": [1, 2, 3],
"value": ["foo", "boo", "zoo"],
"name": ["teddy", "timmy", "tommy"]
})
print(df)

wr.s3.to_parquet(
    df=df,
    path='s3://client/awsdatacatalog/',
    dataset=True,
    mode="overwrite",
    database="client_rs",
    table='newtable'
)
wr.s3.read_parquet(path, dataset=True)

Any idea what could be wrong here. This seems pretty straightforward, but nevertheless, it's not working.

enter image description here

  • Related