Skip to main content

DBT-PUMPKIN

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

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.0
File Size Uploaded
dbt_pumpkin-0.5.0.tar.gz 22.9 kB Details

Built distribution (wheel)

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

Total release size: 49.8 kB

Release files / dbt_pumpkin-0.5.0.tar.gz

Download URL dbt_pumpkin-0.5.0.tar.gz
Size 22.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1368fb9e9f69849d0bdcd54c0730df8bf74a6372e041922ee233cc815892db6a
BLAKE2b-256 checksum
How to use checksums
43f509a85891a1e67ec54074562157fb3fab203f94c79cb4e84aae3a54fc1b13
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.13"},"installer":{"name":"hatch","version":"1.17.1"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.12.13","system":{"name":"Linux","release":"6.17.0-1018-azure"}} HTTPX2/2.5.0

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

Download URL dbt_pumpkin-0.5.0-py3-none-any.whl
Size 27.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a5cfc7c633c46150c527a10c316e42317b24d8a8ac9d83b082e27c1ccd8199c9
BLAKE2b-256 checksum
How to use checksums
2bb9166e2a222fb983441e57f4c3922392c5edb770c1aa957d1ca4fac646826f
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.13"},"installer":{"name":"hatch","version":"1.17.1"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.12.13","system":{"name":"Linux","release":"6.17.0-1018-azure"}} HTTPX2/2.5.0

Release history Release notifications | RSS feed

0.5.2

2 release files

0.5.1

2 release files

This release

0.5.0 This release

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