Skip to main content

Elementary CLI Setup

The CLI tool allows users to generate reports and visuallize results based on the tests we just configured. While we have already added the Elementary packages to our dbt project, the Elementary CLI requires a separate installation, as it is a Python tool.
Important: Both dbt Cloud and dbt Core users will need to run the Elementary CLI locally. If you are a cloud user, you will need to ensure your configuration has met all the prerequisites.
Run one of the following commands based on your platform:

Install Elementary CLI

To install the monitor module run:
pip install elementary-data
Run one of the following commands based on your platform (no need to run all):
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]'
## 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.

Configuring the Elementary Profile

In order to connect, Elementary needs a connection 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):
dbt run-operation elementary.generate_elementary_cli_profile
Ensure that you fill in your password and any other missing fields after you paste the profile in your local profiles.yml file.
Copy the output, fill in the missing fields and add the profile to your profiles.yml. Here is a demonstration:

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
## 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

Running Elementary

Now that we have added Elementary tests to our schemas.yml file, it’s time to run our first tests. We begin by running on a subset of our data that is all valid:
dbt run --vars "{'anomalies': False}"
Note: Here we are setting the anomalies flag to False - only seeding valid data to our DWH.

Your First Test

Now that we have populated our data warehouse with valid data, we will run our tests and ensure that everything passes:
dbt test
All of our tests (except the dbt project’s example tests) should pass. Now, let’s visualize our results:
edr report
Demo
You’ve just run your first Elementary report!

Let’s get real though…

Data is rarely perfect. Let’s get real and add some more data to our project:
dbt run --vars "{'anomalies': True}"
Now let’s run our tests again:
dbt test
Now we should see our Elementary tests fail! Now let’s visualize this failure:
edr report

Congratulations!

Congratulations, you successfully configured Elementary’s tests and ran the report! For additional information and help, you can use one of these channels:
  • Slack (live chat with the team, community support, discussions, etc.)
  • GitHub (bug reports, feature requests, contributions)
  • 📧 Contact us directly at [email protected]
Any feedback would be highly appreciated 🤗