Prism
v0.1.9rc2
v0.1.9rc2
  • 👋Welcome to Prism!
  • Getting Started
    • Installation
    • Creating your first project
    • Why Prism?
  • Fundamentals
    • Tasks
      • tasks
      • hooks
        • hooks.sql
        • hooks.spark
        • hooks.dbt_ref
    • Targets
      • Multiple targets
    • Config files
      • prism_project.py
        • RUN_ID / SLUG
        • SYS_PATH_CONF
        • THREADS
        • PROFILE_YML_PATH / PROFILE
        • PRISM_LOGGER
        • TRIGGERS_YML_PATH / TRIGGERS
      • Profile YML
      • Triggers YML
    • Jinja
      • __file__ and Path
      • prism_project
      • wkdir
      • parent_dir
      • concat
      • env
  • Adapters
    • Overview
    • sql
      • BigQuery
      • Postgres
      • Redshift
      • Snowflake
      • Trino
    • PySpark
    • dbt
  • Agents
    • Overview
    • Docker
    • EC2
  • CLI
    • Command Line Interface
    • init
    • compile
    • connect
    • create
      • agent
      • task
      • trigger
    • graph
    • run
    • spark-submit
    • agent
      • apply
      • run
      • build
      • delete
  • Advanced features
    • Concurrency
    • Logging
    • Triggers
    • Retries
    • Python Client
  • API Reference
    • prism.task.PrismTask
    • @task(...)
    • @target(...)
    • @target_iterator(...)
    • tasks.ref(...)
    • hooks.sql(...)
    • hooks.dbt_ref(...)
  • Use Cases
    • Analytics on top of dbt
    • Machine Learning
  • Wiki
    • DAGs
Powered by GitBook
On this page
  • Usage
  • Example
  1. CLI

connect

Usage

prism connect is used to connect your Prism project to third-party adapters (e.g., Snowflake, Redshift, dbt, etc.)

Usage: prism connect [-h] --type TYPE [--full-tb] [-l] [--vars [A=a B=b ...]] [--context '{}']

Connect your Prism project to third-party adapters (e.g., Snowflake, Redshift, dbt, etc.)

Options:
  -h, --help            show this help message and exit

Command Options:
  --type TYPE           Connection type. One of `bigquery`,`dbt`,`postgres`,`pyspark`,`redshift`,`snowflake`,`trino`

General Options:
  --full-tb             Display the full traceback for errors in the project; default is False
  -l, --log-level       Log level, must be one of `info`, `warn`, `error`, or `debug`. Default is `info`
  --vars [A=a B=b ...]  Prism variables as key-value pairs `key=value`. These overwrite any variable definitions in `prism_project.py`. All values are read as strings.
  --context '{}'        Prism variables as JSON. Cannot co-exist with --vars. These overwrite any variable definitions in `prism_project.py`.

Here's what prism connect does under the hood:

  1. Parses the prism_project.py file and gets the PROFILE_YML_PATH value. If this value isn't specified, then it defaults to the project directory.

  2. It checks to see if PROFILE_YML_PATH exists

    • If it doesn't, it creates a new YML file at PROFILE_YML_PATH and populates it with a profile of type --type

    • If it does, it then adds a profile of type --type to the existing file.

Example

Here's what the output will look like in Terminal (if there are no errors in the project):

$ prism connect --type snowflake
--------------------------------------------------------------------------------
<HH:MM:SS> | INFO  | Running with prism v0.1.9rc2...
<HH:MM:SS> | INFO  | Found project directory at /Users/my_first_project
 
<HH:MM:SS> | INFO  | RUNNING EVENT 'parsing prism_project.py'................................................ [RUN]
<HH:MM:SS> | INFO  | FINISHED EVENT 'parsing prism_project.py'............................................... [DONE in 0.03s]
 
<HH:MM:SS> | INFO  | Setting up profile...
 
<HH:MM:SS> | INFO  | Done!
--------------------------------------------------------------------------------

Here's what the profile.yml file looks like after running the above command:

# profile.yml

profile_name:
  adapters:
    snowflake_adapter_name_here:
      type: snowflake
      user: nullt
      password: null
      account: null
      role: null
      warehouse: null
      database: null
      schema: null
PreviouscompileNextcreate

Last updated 1 year ago