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.2

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.2
File Size Uploaded
dbt_pumpkin-0.5.2.tar.gz 23.0 kB Details

Built distribution (wheel)

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

Total release size: 50.0 kB

Release files / dbt_pumpkin-0.5.2.tar.gz

Download URL dbt_pumpkin-0.5.2.tar.gz
Size 23.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5108e43e94f1dc4da62a345b8dc5b888b118dc98e0fce8f374c381c9d653863b
BLAKE2b-256 checksum
How to use checksums
006035e9ee1080a0c42477d5d8c2e8e753871a49dbfead8e80b59249a39636a6
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.2-py3-none-any.whl

Download URL dbt_pumpkin-0.5.2-py3-none-any.whl
Size 27.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f5318f19a0d18e506624abb0f9440d2ad6f312b10a8a6cedd157934c0ce1eb95
BLAKE2b-256 checksum
How to use checksums
b9683288da2b50a33fb9fc497cfc927de99a8bc1b6a75c9c08021c4736140933
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

This release

0.5.2 This release

2 release files

0.5.1

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