Georgi Milanov
04/23/2024, 7:14 AMMarvin
04/23/2024, 7:14 AMprefect-snowflake
package. Here's an excerpt from the documentation that explains the process:
1. Install prefect-snowflake
package using pip:
pip install prefect-snowflake
2. Save your Snowflake credentials as a credentials block:
python
from prefect_snowflake import SnowflakeCredentials
credentials = SnowflakeCredentials(
account="ACCOUNT-PLACEHOLDER", # resembles nh12345.us-east-2.aws
user="USER-PLACEHOLDER",
password="PASSWORD-PLACEHOLDER"
)
credentials.save("CREDENTIALS-BLOCK-NAME-PLACEHOLDER")
3. Then, create and save a Snowflake connector block:
python
from prefect_snowflake import SnowflakeConnector
credentials = SnowflakeCredentials.load("CREDENTIALS-BLOCK-NAME-PLACEHOLDER")
connector = SnowflakeConnector(
credentials=credentials,
database="DATABASE-PLACEHOLDER",
schema="SCHEMA-PLACEHOLDER",
warehouse="WAREHOUSE-PLACEHOLDER"
)
connector.save("CONNECTOR-BLOCK-NAME-PLACEHOLDER")
4. Register blocks in this module to view and edit them on Prefect Cloud (applicable for Prefect Cloud, modify if necessary for your self-hosted setup):
prefect block register -m prefect_snowflake
Please note that the placeholders in the code should be replaced with your actual Snowflake credentials, database, schema, and warehouse names.
For more detailed information and setup instructions, you can visit the Prefect Snowflake documentation.Nate
04/23/2024, 10:54 AMGeorgi Milanov
04/24/2024, 6:52 AMMarvin
04/24/2024, 6:52 AMEXTRA_PIP_PACKAGES
, you can set environment variables when configuring your Kubernetes work pool. If you're using a Prefect-maintained image, and the image's entrypoint isn't overwritten, you can specify the Python packages to be installed at runtime. For example, you would add the following to your environment variables configuration:
json
{"EXTRA_PIP_PACKAGES": "prefect-snowflake==0.0.1"}
This will install the prefect-snowflake
package when the flow run starts. Replace prefect-snowflake==0.0.1
with the specific package and version you wish to install.
For more information on setting up the Kubernetes deployment and work pool configuration, please refer to the Prefect Kubernetes Deployment Guide.
If you need to include multiple packages, you can list them separated by spaces within the EXTRA_PIP_PACKAGES
environment variable, much like you would in a requirements.txt
file:
json
{"EXTRA_PIP_PACKAGES": "prefect-snowflake==0.0.1 another-package==2.0.0"}
Remember to replace the package names and versions with those that you actually need.