AttributeError: DataFrame object has no attribute _session

snowflakeuser
snowflakeuser Registered Posts: 7 ✭✭✭
edited July 16 in Using Dataiku

I got the error while running the following piece of code. Can anyone tell me whats wrong ?

# get output dataset
LOANS_FE = dataiku.Dataset("LOANS_FE")

# write input dataframe to output dataset
dku_snowpark.write_with_schema(LOANS_FE,snowdf)

AttributeError                            Traceback (most recent call last)
<ipython-input-34-bdd96a80a1c7> in <cell line: 5>()
      3 
      4 # write input dataframe to output dataset
----> 5 dku_snowpark.write_with_schema(LOANS_FE,snowdf)
      6 #LOANS_FE.write_with_schema(snowdf)

/home/dataiku/dataiku-dss-11.0.0/python/dataiku/snowpark/snowpark.py in write_with_schema(self, dataset, df, force_direct_write, dropAndCreate)
    134         :param dropAndCreate: drop and recreate the dataset.
    135         """
--> 136         return self.write_dataframe(dataset, df, True, force_direct_write, dropAndCreate)
    137 
    138     def write_dataframe(self, dataset, df, infer_schema=False, force_direct_write=False, dropAndCreate=False):

/home/dataiku/dataiku-dss-11.0.0/python/dataiku/snowpark/snowpark.py in write_dataframe(self, dataset, df, infer_schema, force_direct_write, dropAndCreate)
    153             raise ValueError("Dataframe is not a Snowpark dataframe. Use dataset.write_dataframe() instead.")
    154 
--> 155         df_connection_name = df._session.dss_connection_name if hasattr(df._session, "dss_connection_name") else None
    156         dataset_config = dataset.get_config()
    157         dataset_info = dataset.get_location_info()["info"]

/data/dataiku/datadir/code-envs/python/snowpark/lib/python3.8/site-packages/snowflake/snowpark/dataframe.py in __getattr__(self, name)
    521         # Snowflake DB ignores cases when there is no quotes.
    522         if name.lower() not in [c.lower() for c in self.columns]:
--> 523             raise AttributeError(    524                 f"{self.__class__.__name__} object has no attribute {name}"
    525             )

AttributeError: DataFrame object has no attribute _session

Operating system used: Windows 10


Operating system used: Windows 10

Tagged:

Answers

Setup Info
    Tags
      Help me…