- Custom CI Integrations: Submitting information to Datafold about what tables to diff in CI
- dbt CI Integrations: Submitting dbt artifacts via CI runner
- dbt development: Kick off data diffs from the command line while developing in your dbt project
Install
First, create and activate your virtual environment for Python:CLI environment variables
To use the Datafold CLI, you need to set up some environment variables:app.datafold.com, set the custom domain as the variable:
Custom CI Integrations
Please follow our CI orchestration docs to set up a custom CI integration levering the Datafold SDK.dbt Core CI Integrations
When you set up Datafold CI diffing for a dbt Core project, we rely on the submission ofmanifest.json files to represent the production and staging versions of your dbt project.
Please see our detailed docs on how to set up Datafold in CI for dbt Core, and reach out to our team if you have questions.
CLI
Python
Diffing dbt models in development
It can be beneficial to diff between two dbt environments before opening a pull request. This can be done using the Datafold SDK from the command line:dbt run or dbt build command will be compared.
Running Data Diffs before opening a pull request
It can be helpful to view Data Diff results in your ticket before creating a pull request. This enables faster code reviews by letting developers QA changes earlier. To do this, you can create a draft PR and run the following command:Update your dbt_project.yml with configurations
Option 1: Add variables to the dbt_project.yml
prod_custom_schema: will vary based on how you have setup dbt.
This variable is used when a model has a custom schema and becomes dynamic when the string literal <custom_schema> is present. The <custom_schema> substring is replaced with the custom schema for the model in order to support the various ways schema name generation can be overridden here — also referred to as “advanced custom schemas”.
Examples (not exhaustive)
Single production schema
If your prod environment looks like this …
Option 2: Specify a production manifest.json using --state
Using the --state option is highly recommended for dbt projects with multiple target database and schema configurations. For example, if you customized the generate_schema_name macro, this is the best option for you.
Note:dbt lsis preferred overdbt compileas it runs faster and data diffing does not require fully compiled models to work.
