# connect

## Usage

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

```
Usage: prism connect [OPTIONS]                                                                                                      
                                                                                                                                     
 Connect your Prism project to third-party adapters (e.g., Snowflake, BigQuery, PySpark, etc.).                                      
                                                                                                                                     
 Examples:                                                                                                                           
                                                                                                                                     
  • prism connect --type snowflake
  • prism connect --type snowflake -v PROFILE_YML_PATH=/Users/.prism/profile.yml
  • prism connect --type snowflake --context '{"PROFILE_YML_PATH", "/Users/.prism/profile.yml"}'
                                                                                                                                     
─ Options ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ *  --type       -t  [bigquery|dbt|postgres|pyspark|redshift|snowflake|trino|presto]  Connection type                                                          │
│                                                                                      [required]                                                               │
│    --log-level  -l  [info|warn|error|debug]                                          Set the log level                                                        │
│    --full-tb                                                                         Show the full traceback when an error occurs                             │
│    --vars       -v  TEXT                                                             Variables as key value pairs. These overwrite variables in               │
│                                                                                      prism_project.py. All values are intepreted as strings.                  │
│    --context        TEXT                                                             Context as a dictionary. Must be a valid JSON. These overwrite variables │
│                                                                                      in prism_project.py                                                      │
│    --help                                                                            Show this message and exit.                                              │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
```

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.2.5...
<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:

```yaml
# profile.yml

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.runprism.com/v0.2.5/cli/connect.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
