> ## Documentation Index
> Fetch the complete documentation index at: https://docs.elementary-data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart: Elementary CLI

<Info> Elementary supports Python versions 3.9 - 3.12, aligning with the [versions supported by dbt](https://docs.getdbt.com/faqs/Core/install-python-compatibility#python-compatibility-matrix).</Info>

Before installing the CLI, make sure to complete the steps dbt package installation, including executing `dbt run` with the Elementary package models.

<Accordion title="dbt package installation">
  ## How to install Elementary dbt package?

  <Frame>
    <iframe src="https://www.loom.com/embed/5cf1aaa0708f43a993f8a2945473c7ac" frameborder="0" webkitAllowFullScreen mozAllowFullScreen allowfullscreen className="w-full" style={{ height: "16rem" }} />
  </Frame>
</Accordion>

## Configuring the Elementary Profile

In order to connect, Elementary needs a [connection profile](https://docs.getdbt.com/dbt-cli/configure-your-profile) in a file named `profiles.yml`.
This profile will be used by the CLI, to connect to the DWH and find the dbt package tables.

The easiest way to generate the profile is to run the following command within the dbt project where you deployed the elementary dbt package (works in dbt cloud as well):

```shell theme={null}
dbt run-operation elementary.generate_elementary_cli_profile
```

<Warning>
  Ensure that you fill in your password and any other missing fields after you
  paste the profile in your **local** `profiles.yml` file.
</Warning>

Copy the output, fill in the missing fields and add the profile to your `profiles.yml`.
Here is a demonstration:

<Frame>
  <div style={{ paddingBottom: "64.98194945848375%" }}>
    <iframe
      src="https://www.loom.com/embed/6eacaed618a746658a3c8e920d1d46b2"
      frameborder="0"
      webkitAllowFullScreen
      mozAllowFullScreen
      allowfullscreen
      style={{
    position: "absolute",
    top: 0,
    left: 0,
    width: "100%",
    height: "100%",
  }}
    />
  </div>
</Frame>

### Elementary profile details and format

* Path: `HOME_DIR/.dbt/profiles.yml`
* Profile name: `elementary`
* Schema name: The schema of elementary models, default is `<your_dbt_project_schema>_elementary`

<CodeGroup>
  ```yml Snowflake theme={null}
  ## SNOWFLAKE ##
  ## By default, edr expects the profile name 'elementary'.      ##
  ## Configure the database and schema of elementary models.     ##
  ## Check where 'elementary_test_results' is to find it.        ##

  elementary:
    outputs:
      default:
        type: snowflake
        account: [account id]
        user: [username]
        role: [user role]

        ## Keypair auth (recommended) ##
        private_key_path: [path/to/private.key]
        # or private_key instead of private_key_path
        private_key_passphrase: [passphrase for the private key, if key is encrypted]
        
        database: [database name]
        warehouse: [warehouse name]
        schema: [schema name]_elementary
        threads: 4
  ```

  ```yml BigQuery theme={null}
  ## BIGQUERY ##
  ## By default, edr expects the profile name 'elementary'.      ##
  ## Configure the database and schema of elementary models.     ##
  ## Check where 'elementary_test_results' is to find it.        ##

  elementary:
    outputs:
      default:
        type: bigquery

        ## Service account auth ##
        method: service-account
        keyfile: [full path to your keyfile]

        project: [project id]
        dataset: [dataset name] # elementary dataset, usually [dataset name]_elementary
        threads: 4
        location: [dataset location]
        priority: interactive
  ```

  ```yml Redshift theme={null}
  ## REDSHIFT ##
  ## By default, edr expects the profile name 'elementary'.      ##
  ## Configure the database and schema of elementary models.     ##
  ## Check where 'elementary_test_results' is to find it.        ##

  elementary:
    outputs:
      default:
        type: redshift
        host: [hostname, like hostname.region.redshift.amazonaws.com]

        ## User/password auth ##
        user: [username]
        password: [password]

        dbname: [database name]
        schema: [schema name] # elementary schema, usually [schema name]_elementary
        threads: 4
        keepalives_idle: 240 # default 240 seconds
        connect_timeout: 10 # default 10 seconds
        # search_path: public # optional, not recommended
        sslmode:
          [
            optional,
            set the sslmode used to connect to the database (in case this parameter is set,
            will look for ca in ~/.postgresql/root.crt),
          ]
        ra3_node: true # enables cross-database sources
  ```

  ```yml Databricks theme={null}
  ## DATABRICKS ##
  ## By default, edr expects the profile name 'elementary'.      ##
  ## Configure the database and schema of elementary models.     ##
  ## Check where 'elementary_test_results' is to find it.        ##

  elementary:
    outputs:
      default:
        type: databricks
        host: [hostname, like <ID>.cloud.databricks.com]
        http_path: [like /sql/1.0/endpoints/<ID>]
        schema: [schema name] # elementary schema, usually [schema name]_elementary
        token: [token]
        threads: [number of threads like 8]
  ```

  ```yml Postgres theme={null}
  ## POSTGRES ##
  ## By default, edr expects the profile name 'elementary'.      ##
  ## Configure the database and schema of elementary models.     ##
  ## Check where 'elementary_test_results' is to find it.        ##

  elementary:
    outputs:
      default:
        type: postgres
        host: [hostname]
        user: [username]
        password: [password]
        port: [port]
        dbname: [database name]
        schema: [schema name] # elementary schema, usually [schema name]_elementary
        threads: [1 or more]
        keepalives_idle: 0 # default 0 seconds
        connect_timeout: 10 # default 10 seconds
        # search_path: public # optional, not recommended
        # role: [optional, set the role dbt assumes when executing queries]
        # sslmode: [optional, set the sslmode used to connect to the database]
  ```

  ```yml Athena theme={null}
  ## ATHENA ##
  ## By default, edr expects the profile name 'elementary'.      ##
  ## Configure the database and schema of elementary models.     ##
  ## Check where 'elementary_test_results' is to find it.        ##

  elementary:
    outputs:
      default:
        type: athena
        work_group: [athena workgroup]
        s3_staging_dir: [s3_staging_dir] # Location to store query results & metadata
        s3_data_dir: [s3 data dir] # Location to store table data (if not specified, s3_staging_dir is used)
        region_name: [aws region name] # AWS region, e.g. eu-west-1
        database: [database name]
        schema: [schema name] # elementary schema, usually [schema name]_elementary
        threads: [number of threads like 8]
  ```

  ```yml Clickhouse theme={null}
  ## Clickhouse ##
  ## By default, edr expects the profile name 'elementary'.      ##
  ## Configure the database and schema of elementary models.     ##
  ## Check where 'elementary_test_results' is to find it.        ##

  elementary:
    outputs:
      default:
        type: clickhouse
        schema: [schema name] # elementary schema, usually [schema name]_elementary
        host: [hostname]
        port: [port]
        user: [username]
        password: [password]
        threads: [number of threads like 8]
  ```

  ```yml Trino theme={null}
  ## Trino ##
  ## By default, edr expects the profile name 'elementary'.      ##
  ## Configure the database and schema of elementary models.     ##
  ## Check where 'elementary_test_results' is to find it.        ##

  elementary:
    outputs:
      default:
        type: trino
        host: [hostname]
        port: [port]
        database: [database name]
        schema: [schema name] # elementary schema, usually [schema name]_elementary
        threads: [1 or more]
        method: [authentication method] # ldap, oauth etc.
        user: [username]
        # password: [optional, used with ldap authentication ]
        # session_properties: [optional, sets Trino session properties used in the connection]
  ```

  ```yml DuckDB theme={null}
  ## DUCKDB ##
  ## By default, edr expects the profile name 'elementary'.      ##
  ## Configure the database and schema of elementary models.     ##
  ## Check where 'elementary_test_results' is to find it.        ##

  elementary:
    outputs:
      default:
        type: duckdb
        path: [path to your .duckdb file]
        schema: [schema name] # elementary schema, usually [schema name]_elementary
        threads: [1 or more]
  ```

  ```yml Dremio theme={null}
  ## DREMIO ##
  ## By default, edr expects the profile name 'elementary'.      ##
  ## Configure the database and schema of elementary models.     ##
  ## Check where 'elementary_test_results' is to find it.        ##

  ## -- Dremio Cloud -- ##
  elementary:
    outputs:
      default:
        type: dremio
        cloud_host: api.dremio.cloud  # or api.eu.dremio.cloud for EU
        cloud_project_id: [project ID]
        user: [email address]
        pat: [personal access token]
        use_ssl: true
        object_storage_source: [name]  # alias: datalake
        object_storage_path: [path]    # alias: root_path
        dremio_space: [name]           # alias: database
        dremio_space_folder: [path]    # alias: schema, usually [schema]_elementary
        threads: [1 or more]

  ## -- Dremio Software -- ##
  elementary:
    outputs:
      default:
        type: dremio
        software_host: [hostname or IP address]
        port: 9047
        user: [username]
        password: [password]  # or use pat: [personal access token]
        use_ssl: [true or false]
        object_storage_source: [name]  # alias: datalake
        object_storage_path: [path]    # alias: root_path
        dremio_space: [name]           # alias: database
        dremio_space_folder: [path]    # alias: schema, usually [schema]_elementary
        threads: [1 or more]
  ```

  ```yml Spark theme={null}
  ## SPARK ##
  ## By default, edr expects the profile name 'elementary'.      ##
  ## Configure the database and schema of elementary models.     ##
  ## Check where 'elementary_test_results' is to find it.        ##

  elementary:
    outputs:
      default:
        type: spark
        method: [thrift, http, or odbc]
        host: [hostname]
        port: [port]
        user: [username]
        schema: [schema name] # elementary schema, usually [schema name]_elementary
        threads: [1 or more]
        # token: [optional, used with http method]
  ```

  ```yml Fabric theme={null}
  ## FABRIC ##
  ## By default, edr expects the profile name 'elementary'.      ##
  ## Configure the database and schema of elementary models.     ##
  ## Check where 'elementary_test_results' is to find it.        ##

  elementary:
    outputs:
      default:
        type: fabric
        driver: ODBC Driver 18 for SQL Server
        server: [hostname]
        port: 1433
        database: [database name]
        schema: [schema name] # elementary schema, usually [schema name]_elementary
        authentication: ActiveDirectoryServicePrincipal
        tenant_id: [tenant_id]
        client_id: [client_id]
        client_secret: [client_secret]
        threads: [1 or more]
  ```

  ```yml SQL Server theme={null}
  ## SQL SERVER ##
  ## By default, edr expects the profile name 'elementary'.      ##
  ## Configure the database and schema of elementary models.     ##
  ## Check where 'elementary_test_results' is to find it.        ##

  elementary:
    outputs:
      default:
        type: sqlserver
        driver: ODBC Driver 18 for SQL Server
        server: [hostname]
        port: 1433
        database: [database name]
        schema: [schema name] # elementary schema, usually [schema name]_elementary
        user: [username]
        password: [password]
        threads: [1 or more]
        # encrypt: true # default true in dbt-sqlserver >= 1.2.0
        # trust_cert: false
  ```

  ```yml Vertica theme={null}
  ## VERTICA ##
  ## By default, edr expects the profile name 'elementary'.      ##
  ## Configure the database and schema of elementary models.     ##
  ## Check where 'elementary_test_results' is to find it.        ##

  elementary:
    outputs:
      default:
        type: vertica
        host: [hostname]
        port: 5433
        database: [database name]
        schema: [schema name] # elementary schema, usually [schema name]_elementary
        username: [username]
        password: [password]
        threads: [1 or more]
        # connection_load_balance: true
        # backup_server_node: [comma separated list of backup hostnames or IPs]
  ```
</CodeGroup>

<Accordion title="What is a connection profile?">
  Elementary requires connection details and credentials to connect to the data warehouse.

  These are configured in a connection profile using a file named `profiles.yml`.

  **We recommend creating a dedicated database, or at least a schema.**

  Elementary leverages dbt's [connection profile](https://docs.getdbt.com/dbt-cli/configure-your-profile) format.

  **dbt-core users**
  Just add a profile with the relevant details, and name it `elementary`.
</Accordion>

<Accordion title="What permissions are required for the elementary profile?">
  The provided credentials need to have permission to:

  * Read - Information schema and the tables configured for monitoring.,
  * Write - To the database configured in `elementary` profile, including creating new schemas.
</Accordion>

## Install Elementary CLI

To install the monitor module run:

```shell theme={null}
pip install elementary-data
```

Run one of the following commands based on your platform (no need to run all):

```shell theme={null}
pip install 'elementary-data[snowflake]'
pip install 'elementary-data[bigquery]'
pip install 'elementary-data[redshift]'
pip install 'elementary-data[databricks]'
pip install 'elementary-data[athena]'
pip install 'elementary-data[trino]'
pip install 'elementary-data[clickhouse]'
pip install 'elementary-data[duckdb]'
pip install 'elementary-data[dremio]'
pip install 'elementary-data[spark]'
pip install 'elementary-data[vertica]'
## Postgres doesn't require this step
```

Run `edr --help` in order to ensure the installation was successful.

If you're receiving `command not found: edr` please check our [troubleshooting guide](/oss/general/troubleshooting).
