Writing a pandas dataframe to Snowflake table using writer

Megha
Megha Registered Posts: 3 ✭✭✭
edited July 16 in General Discussion

Hi ,

I am trying to write a Pandas Dataframe containing 1.58 million records to a snowflake table.

To make the procss faster, i wanted to use the chunked writer functionality available under: Datasets (reading and writing data) — Dataiku DSS 11 documentation.

I have the dataframe named "Out_df" containing 1.5m records which i want to write to Snowflake table "RM20_DATA"

when I execute the below piece of code, I get an error as below:

AttributeError: 'DataFrame' object has no attribute 'iter_dataframes'

I understand that the method iter_dataframes() cannot work on a dataframe but works on a dataset.

How can I convert my out_df to a dataset that can be iterated using iter_dataframes() function to write the data.

----Code---

rm20_data = dataiku.Dataset("RM20_DATA")
rm20_data.write_schema_from_dataframe(Out_df)
with rm20_data.get_writer() as writer:

for df in Out_df.iter_dataframes():
# Process the df dataframe ...

# Write the processed dataframe
writer.write_dataframe(df)


Operating system used: windows

Tagged:

Answers

Setup Info
    Tags
      Help me…