Metadata-Version: 2.4
Name: dbtective
Version: 0.1.25
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Rust
Classifier: Topic :: Software Development :: Quality Assurance
License-File: LICENSE
Summary: dbtective is a Rust-powered 'detective' for `dbt metadata` best practices.
Keywords: dbt,linter,data,metadata,analytics,cli
Home-Page: https://github.com/feliblo/dbtective
Author-email: feliblo <hi@feliblo.dev>
Requires-Python: >=3.8
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Repository, https://github.com/feliblo/dbtective
Project-URL: Changelog, https://github.com/feliblo/dbtective/blob/master/CHANGELOG.md
Project-URL: Releases, https://github.com/feliblo/dbtective/releases
Project-URL: Homepage, https://feliblo.github.io/dbtective/

# 🕵️ dbtective

dbtective is a Rust-powered 'detective' for `dbt metadata` best practices. As your dbt project grows, keeping metadata consistent and high-quality can become a real challenge.

Explore the [full documentation](https://feliblo.github.io/dbtective/docs) or the [possible checks](https://feliblo.github.io/dbtective/docs/checks).

> [!WARNING]
> dbtective is currently in very early stages.
> Issues and commits are welcome, but don't rely on us yet!

**dbtective** makes it easy to spot and fix common issues, examples:

- **Missing descriptions:** Does every model and seed have a description?
- **Column types:** Are all columns explicitly typed?
- **Ownership:** Do all sources have an owner?
- **Naming conventions:** Are all marts following your team's naming standards?

We detect and enforce these rules in your `cli`, `prek`/`pre-commit` and `CI/CD` pipeline, so fast you will barely notice🕵️.

## Installationcheck

<details>
<summary>Pip (pypi)</summary>

```bash
pip install dbtective
```

</details>

<details>
<summary> uv </summary>

Install as a dev dependency:

```bash
uv add dbtective --dev
```

</details>

<details>
<summary>Homebrew</summary>

```bash
brew install feliblo/tap/dbtective
```

</details>

<details>
<summary>GitHub Actions</summary>

Run dbtective as part of your CI/CD pipeline. See the [GitHub Actions documentation](https://feliblo.github.io/dbtective/docs/github-actions) for more details.

```yaml
- uses: feliblo/dbtective@v0.1.21
  with:
    config-file: "dbtective.yml"
    entry-point: "."
    only-manifest: "true"
    verbose: "false"
```

</details>

<details>
<summary>prek/pre-commit</summary>

Prerequisite: `dbtective` is installed via one of the methods above.

We (currently) recommend using the `--only-manifest` flag with prek/pre-commit to avoid issues caused by `catalog.json` mismatches. For more details, see the explanation in the [checks documentation](https://feliblo.github.io/dbtective/docs/).

Add the following to your `.pre-commit-config.yaml`.

```yaml
repos:
  - repo: https://github.com/feliblo/dbtective
    rev: v0.1.21
    hooks:
      - id: dbtective-run
        args: [--only-manifest]
```

And run

```bash
prek install
prek run --all-files
# or with pre-commit
pre-commit install
pre-commit run --all-files

```

</details>

<details>
<summary>Shell installer (macOS/Linux)</summary>

```bash
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/feliblo/dbtective/releases/latest/download/dbtective-installer.sh | sh
```

</details>

<details>
<summary>PowerShell installer (Windows)</summary>

```powershell
irm https://github.com/feliblo/dbtective/releases/latest/download/dbtective-installer.ps1 | iex
```

</details>

<details>
<summary>Binary download</summary>

Pre-built binaries for Linux, macOS, and Windows are available on the [releases page](https://github.com/feliblo/dbtective/releases).
</details>

## Quickstart

All possible checks can be found in the [checks documentation](https://feliblo.github.io/dbtective/docs/). Information about configuring `dbtective` is shown at the [config documentation](https://feliblo.github.io/dbtective/docs/config)

### Example

1. Create a `dbtective.yml` config file in the root of your dbt project. For example:

```yaml
manifest_tests:
  - name: "models_must_have_description"
    type: "has_description"
    severity: "error"
    applies_to: ["models", "sources"]
    description: " models and sources must have a description."

  - name: "naming_convention"
    type: "name_convention"
    description: "Everything must follow the naming convention."
    pattern: "snake_case"

 - name: "all_marts_must_be_tagged"
    type: "has_tags"
    severity: "warning"
    applies_to: ["models"]
    tags:
      - "mart"
    description: "All marts must be tagged with 'mart'"
```

2. Run `dbtective` in the root of your current directory or specify an entry point if your dbt_project is not located in the root/current drectory.

```bash
dbtective run
dbtective run --entry-point "my_dbt_project"
```

## Contributing

We welcome contributions! Whether you're fixing bugs, adding features, or improving documentation, your help makes dbtective better for everyone.

**Quick start:**
Install [just](https://github.com/casey/just) command line runner & take a look at the commands in the justfile.

To build and run on the example project (`./dbt_project` using config `./dbt_project/dbtective.yml`) use:

```bash
just run
just run-verbose
```

For detailed contributing guidelines, development setup, and coding standards, please see [CONTRIBUTING.md](./CONTRIBUTING.md).


# Acknowledgements

This project is heavily inspired dbt [dbt-bouncer](https://github.com/godatadriven/dbt-bouncer). It tries to improve certain aspects of the amazing work by [pgoslatara](https://github.com/pgoslatara), while giving me an opportunity to improve my Rust. More about the aspects we try to improve is available in our  [FAQ](https://feliblo.github.io/dbtective/docs/faq).

