Skip to main content

Environment diff tool for dbt

Project description

recce

recce is a environment diff tool for dbt

Features

  1. Support both Web UI & CLI
  2. Multiple diff tools, including lineage diff, schema diff, and query diff. And more in the future.
  3. Use the dbt-core adapter framework to connect to your data warehouse. No additional configuration required.

Use cases

  1. During development, we can verify new results by contrasting them with those from production prior to pushing the changes.
  2. While reviewing PR, you can grasp the extent of the changes and their impact before merge.
  3. For troubleshooting, you can execute ad-hoc diff queries to pinpoint the root causes.

Usage

Prerequisites

You have to have at least two environments in your dbt project. For example, one is for developing and another is for production. You can prepare two targets with separate schemas in you dbt profile. Here is profiles.yml example

jaffle_shop:
  target: dev
  outputs:
    dev:
      type: duckdb
      path: jaffle_shop.duckdb
      schema: dev
    prod:
      type: duckdb
      path: jaffle_shop.duckdb
      schema: main

Getting Started

5 minutes walkthrough by jaffle shop example

  1. Installation

    pip install recce
    
  2. Go to your dbt project

    cd your-dbt-project/
    
  3. Prepare base artifacts: DBT generates artifacts when every invocation. You can find these files in the target/ folder.

    artifacts dbt command
    manifest.json dbt run, dbt build, ..
    catalog.json (optional) dbt docs generate

    Copy the artifacts for base environment to target-base/

  4. Run the recce server.

    recce server
    

    Recce would diff environments between target/ and target-base/

Query Diff

You can run query diff in both Web UI and CLI

  • Web UI: Go to Query tab

    select * from {{ ref("mymodel") }}
    
  • CLI:

    recce diff --sql 'select * from {{ ref("mymodel") }}'
    

Primay key

In the query diff, primary key columns serve as the fundamental identifiers for distinguishing each record uniquely across both sides.

  • Web UI: In the query result, click the key icons in the column headers to toggle if it is in the primary key list.

  • CLI: Use the option --primary-keys to specify the primary keys. Use comma to separate the columns if it is a compound key.

    recce diff --primary-keys event_id --sql 'select * from {{ ref("events") }} order by 1'
    

Q&A

Q: How recce connect to my data warehouse? Does recce support my data warehouse?

recce use the dbt adapter to connect to your warehouse. So it should work for your data warehouse.

Q: What credential does recce connect to the two environments?

Recce uses the same target in the profile to connect your warehouse. If you use the default target dev, it use the credentials to connect to both environments. So please make sure that the credential able to access both environments.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

recce-0.1.0.tar.gz (520.4 kB view details)

Uploaded Source

Built Distribution

recce-0.1.0-py3-none-any.whl (526.6 kB view details)

Uploaded Python 3

File details

Details for the file recce-0.1.0.tar.gz.

File metadata

  • Download URL: recce-0.1.0.tar.gz
  • Upload date:
  • Size: 520.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for recce-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3ac82a8b09d36d7b0c33d48374e9d1cee586ca6557bfd9484aa1718590088941
MD5 f3096411e8bfcd9646b6bf42ddaa5067
BLAKE2b-256 3a79d698b57914e1529c6df0598e75b2c8f79298e83b9c02334e8f1ff05e1985

See more details on using hashes here.

File details

Details for the file recce-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: recce-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 526.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for recce-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 118cda24ca4a0942afa803a66e3aad45b0f06bac46d966245438b35378dff9dc
MD5 d3d1f2154d070d5186fda275974a044a
BLAKE2b-256 877669f2905cc51398866f7831f4fe33b6c04001ddd569e9f42b9eb642d806fb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page