Skip to main content

DBT-PUMPKIN

PyPI Version

codecov

dbt-pumpkin is a command-line tool which helps to manage DBT projects.

Inspired by dbt-osmosis

Usage

All commands accept --project-dir, --profiles-dir, --target, --profile, --select, --exclude, --dry-run and --debug options (same semantics as dbt).

Bootstrap

Creates missing YAML schema files for resources that have dbt-pumpkin-path configured. Generated files will be empty — use synchronize to populate columns.

dbt-pumpkin bootstrap [OPTIONS]

Relocate

Moves YAML schema files to the location defined by dbt-pumpkin-path. Can split or merge YAML files depending on configuration.

dbt-pumpkin relocate [OPTIONS]

Synchronize

Updates YAML schema files to match actual table/view columns in the database — same columns, same types, same order. Columns absent from the database are removed; descriptions, tests and other properties are preserved.

dbt-pumpkin synchronize [OPTIONS]

Configuration

dbt-pumpkin properties can be set either as top-level config properties (using the + prefix) or via the meta config property:

models:
  "<YOUR_PROJECT_NAME>":
    +meta:
      dbt-pumpkin-path: _schema.yml
      dbt-pumpkin-types:
        numeric-precision-and-scale: true
        string-length: true

dbt-pumpkin-path

dbt-pumpkin-path sets a path to the YAML schema file for a resource. Paths are relative to the resource file (SQL, CSV or PY), or root-relative (starting with /, relative to the dbt project root).

The path is a template supporting {name} (resource name) and {parent} (parent folder name) placeholders.

models:
  "<YOUR_PROJECT_NAME>":
    +dbt-pumpkin-path: _schema.yml        # single shared file next to each model
    staging:
      +dbt-pumpkin-path: _{name}.yml      # one file per model
sources:
  "<YOUR_PROJECT_NAME>":
    # sources have no SQL file, so root-relative path is required
    +dbt-pumpkin-path: /models/staging/_source_{name}.yml

dbt-pumpkin-types

dbt-pumpkin-types controls type verbosity during synchronize:

  • numeric-precision-and-scale — include precision and scale for numeric types (e.g. NUMBER(38,0))
  • string-length — include length for string types (e.g. character varying(256))
  • max-string-length — when used with string-length: true, caps the length at this value
models:
  "<YOUR_PROJECT_NAME>":
    +dbt-pumpkin-types:
      numeric-precision-and-scale: true
      string-length: true
      max-string-length: 256

Applies to models, seeds, snapshots and sources.

YAML Format

You can configure how dbt-pumpkin formats YAML files. For that it's required to add specific DBT variable to your project:

vars:
  dbt-pumpkin:
    yaml_format:
      # indent of properties in a map, default 2
      indent: 2
      # offset of items in a list, default 0
      offset: 2
      # whether to preserve original quotes, default false
      preserve_quotes: true
      # maximum line width, default 80
      max_width: 120

Development

# First install Hatch globally
pip install hatch

# Configure Hatch to create venvs in project
hatch config set dirs.env.virtual .hatch

# test in one venv
hatch test
# test across different python & dbt versions
hatch test --all

# sometimes working DBT project is required to verify user experience
hatch run scripts/generate.py --help
# to generate DBT project with 100 models
hatch run scripts/generate.py 100
hatch run dbt build

# to validate dbt-pumpkin output visually (on test project generated above)
hatch run dbt-pumpkin bootstrap --dry-run
hatch run dbt-pumpkin synchronize

Troubleshooting

Clean envs and caches:

hatch env prune
pip cache purge
# UV is used by default for hatch-test environments
uv cache clean

Metadata

Release files for dbt-pumpkin 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dbt-pumpkin 0.5.1
File Size Uploaded
dbt_pumpkin-0.5.1.tar.gz 23.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dbt-pumpkin 0.5.1
File Interpreter ABI Platform
dbt_pumpkin-0.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 50.0 kB

Release files / dbt_pumpkin-0.5.1.tar.gz

Download URL dbt_pumpkin-0.5.1.tar.gz
Size 23.0 kB
Tags Source
SHA-256 checksum
How to use checksums
bc48f62591903b8afa08c3a52dbe6eb5215c2eb94c1c75cf1c03be131a3b1ad3
BLAKE2b-256 checksum
How to use checksums
5064a8e17f8a04839994d2514947de153ec6c3c6c7ae641ca4ffac33a4f81180
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.17.1 {"ci":true,"cpu":"x86_64","distro":{"id":"noble","libc":{"lib":"glibc","version":"2.39"},"name":"Ubuntu","version":"24.04"},"implementation":{"name":"CPython","version":"3.12.14"},"installer":{"name":"hatch","version":"1.17.1"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.12.14","system":{"name":"Linux","release":"6.17.0-1022-azure"}} HTTPX2/2.13.1

Release files / dbt_pumpkin-0.5.1-py3-none-any.whl

Download URL dbt_pumpkin-0.5.1-py3-none-any.whl
Size 27.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
70be2ed2fd91af5fdd5c1333781dab1f5fd2609d0538248f7d5c57c437f4c259
BLAKE2b-256 checksum
How to use checksums
29defd5f1d45d71336e044cbe3b4b248cb507d90eb1593a10f01657629107abb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.17.1 {"ci":true,"cpu":"x86_64","distro":{"id":"noble","libc":{"lib":"glibc","version":"2.39"},"name":"Ubuntu","version":"24.04"},"implementation":{"name":"CPython","version":"3.12.14"},"installer":{"name":"hatch","version":"1.17.1"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.12.14","system":{"name":"Linux","release":"6.17.0-1022-azure"}} HTTPX2/2.13.1

Release history Release notifications | RSS feed

0.5.2

2 release files

This release

0.5.1 This release

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page