Prism
v0.3.0
v0.3.0
  • 👋Welcome to Prism!
  • Getting Started
    • Installation
    • Creating your first project
    • Why Prism?
  • Fundamentals
    • PrismProject API
      • PrismProject().run
      • PrismProject().graph
    • Tasks
    • Targets
      • Multiple targets
    • CurrentRun API
      • CurrentRun.ref()
      • CurrentRun.conn()
      • CurrentRun.ctx()
  • Connectors
    • Overview
    • BigQueryConnector
    • PostgresConnector
    • RedshiftConnector
    • SnowflakeConnector
    • TrinoConnector
    • PrestoConnector
  • CLI
    • Command Line Interface
    • graph
    • init
    • run
  • Advanced features
    • Concurrency
    • Logging
    • Callbacks
    • Retries
    • Skipping tasks
  • API Reference
    • prism.task.PrismTask
    • @task(...)
    • @target(...)
    • @target_iterator(...)
    • prism.target.PrismTarget
  • Use Cases
    • Analytics on top of dbt
    • Machine Learning
  • Wiki
    • DAGs
Powered by GitBook
On this page
  • Configuration
  • execute_sql
  1. Connectors

SnowflakeConnector

Configuration

The arguments for the Snowflake connector are:

  • id: ID for your connector

  • user: the username to your Snowflake account

  • password: the password to your Snowflake account

  • account: the account name for your Snowflake account

  • role: the desired role for the connection

  • warehouse: the desired warehouse for the connection

  • database: the desired database for the connection

  • schema: 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

You 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.

PreviousRedshiftConnectorNextTrinoConnector

Last updated 1 year ago