SnowflakeConnector
Configuration
The arguments for the Snowflake connector are:
id: ID for your connectoruser: the username to your Snowflake accountpassword: the password to your Snowflake accountaccount: the account name for your Snowflake accountrole: the desired role for the connectionwarehouse: the desired warehouse for the connectiondatabase: the desired database for the connectionschema: the desired schema for the connection
snowflake_connector = SnowflakeConnector(
id="snowflake_connector_id",
user=os.environ["SNOWFLAKE_USER"],
password=os.environ["SNOWFLAKE_PASSWORD"],
account=os.environ["SNOWFLAKE_ACCOUNT"],
role=os.environ["SNOWFLAKE_ROLE"],
warehouse=os.environ["SNOWFLAKE_WAREHOUSE"],
database=os.environ["SNOWFLAKE_DATABASE"],
schema=os.environ["SNOWFLAKE_SCHEMA"],
)Under the hood, Prism takes care of parsing the configuration variables and establishing a connection to your Snowflake account.
execute_sql
execute_sqlYou can run queries against the Snowflake connection using the execute_sql function:
from prism.decorators import task
from prism.runtime import CurrentRun
@task()
def snowflake_task(self):
conn = CurrentRun.conn("snowflake_connector_id")
data = conn.execute_sql(
sql="SELECT * FROM table"
)Note that when return_type = None, the result will be a list tuples containing the query data.
Last updated