You are viewing documentation about an older version (1.3.0). View latest version

snowflake.snowpark.DataFrame.write

property DataFrame.write: DataFrameWriter[source]

Returns a new DataFrameWriter object that you can use to write the data in the DataFrame to a Snowflake database or a stage location

Example::
>>> df = session.create_dataframe([[1, 2], [3, 4]], schema=["a", "b"])
>>> df.write.mode("overwrite").save_as_table("saved_table", table_type="temporary")
>>> session.table("saved_table").show()
-------------
|"A"  |"B"  |
-------------
|1    |2    |
|3    |4    |
-------------

>>> stage_created_result = session.sql("create temp stage if not exists test_stage").collect()
>>> df.write.copy_into_location("@test_stage/copied_from_dataframe")  # default CSV
[Row(rows_unloaded=2, input_bytes=8, output_bytes=28)]
Copy