prefect-snowflake
integration makes it easy to connect to Snowflake in your Prefect flows. You can run queries both synchronously and asynchronously as Prefect flows and tasks.
prefect-snowflake
as a dependency of Prefect.
If you don’t already have Prefect installed, it will install the newest version of prefect
as well.
prefect
and prefect-snowflake
:
prefect-snowflake
integration has two blocks: one for storing credentials and one for storing connection information. Register blocks in this module to view and edit them on Prefect Cloud:
SnowflakeCredentials
block through code. Log into your Snowflake account to find your credentials.
The example below uses a user and password combination, but refer to the SDK documentation for a full list of authentication and connection options.
SnowflakeConnector
block:
execute
and execute_many
methods. Then, use the fetch_all
method. If the results are too large to fit into memory, use the fetch_many
method to retrieve data in chunks.
By using the SnowflakeConnector
as a context manager, you can make sure that the Snowflake connection and cursors are closed properly after you’re done with them.
prefect-snowflake
SDK documentation to explore other capabilities of the prefect-snowflake
library, such as async methods.
For further assistance using Snowflake, consult the Snowflake documentation or the Snowflake Python Connector documentation.