Skip to content

Python Snowflake Process

ArunGMR0411 edited this page Jun 6, 2023 · 3 revisions

Ways of integrating Python and Snowflake

Read table from Snowflake into Pandas:

  1. pd.read_sql(query, connection)
  2. snowflake_obj.fetch_pandas_all("query") Here, a. snowflake_obj is Object created for the Snowflake Class which has made connection to Snowflake. b. fetch_pandas_all is the function to execute the select statement passed as argument and provide us back the resultset as Pandas Dataframe. This is 6x faster than the normal pd.read_sql_query() function.

Writing to a table from Pandas

  1. write_pandas() -> This Function can be used to write our pandas df into snowflake table that we specify.