Skip to main content

Generate and update dbt schema.yml files from a template, manifest, and database

Project description

dbt-schemify

Generate and update dbt schema.yml files automatically from a template, your dbt manifest, and live database columns.

How it works

Three sources are merged in priority order (highest first):

  1. Existing schema.yml — values already there are never overwritten
  2. manifest.json — fills fields marked with the schemify sentinel
  3. .schemify.yml template — defines which fields to include and their static defaults

The sentinel value schemify in the template means "auto-populate this field from the manifest or database".

Installation

pip install dbt-schemify

With your database adapter:

pip install "dbt-schemify[snowflake]"
pip install "dbt-schemify[postgres]"
pip install "dbt-schemify[bigquery]"
pip install "dbt-schemify[duckdb]"

Quick start

1. Create a .schemify.yml template in your dbt project root:

version: '1.0'
models:
  - name: schemify
    description: schemify      # filled from manifest
    meta:
      owner: analytics         # static default applied to all models
    config:
      enabled: true            # static default
    columns:
      - name: schemify
        data_type: schemify    # filled from DB
        description: schemify  # left empty for humans to fill in
        meta:
          gdpr_tags: schemify

2. Compile your dbt project to get a manifest:

dbt compile

3. Run dbt-schemify:

dbt-schemify --schema models/my_folder/schema.yml

Reads .schemify.yml, target/manifest.json, and ~/.dbt/profiles.yml automatically.

Usage

dbt-schemify --schema PATH [options]

Options:
  --schema PATH          Path to schema.yml to generate or update (required)
  --manifest PATH        Path to manifest.json
                         Default: <project-dir>/target/manifest.json
  --template PATH        Path to .schemify.yml template
                         Default: <project-dir>/.schemify.yml
  --project-dir DIR      dbt project root. Default: current directory
  --profile NAME         dbt profile name. Default: read from dbt_project.yml
  --target NAME          dbt target (e.g. dev, prod). Default: profile default
  --profiles-dir DIR     Directory containing profiles.yml. Default: ~/.dbt/
  --models MODEL ...     Only process specific model names
  --no-db                Skip database connection; no column fetching

Examples

# Generate schema without DB (manifest data only)
dbt-schemify --schema models/example/schema.yml --no-db

# Generate schema with DB columns
dbt-schemify --schema models/example/schema.yml --profile my_profile --target dev

# Only specific models
dbt-schemify --schema models/example/schema.yml --models my_model_a my_model_b --no-db

# Custom paths
dbt-schemify \
  --schema models/example/schema.yml \
  --manifest target/manifest.json \
  --template .schemify.yml

Merge rules

Situation Result
Field exists in schema.yml Kept as-is
Field is schemify sentinel + value in manifest Filled from manifest
Field is schemify sentinel + column data_type Filled from DB
Field has a static value in template Used as default
Field not in template Not included in output
Column in DB but not in existing schema Added using template column structure
Column in existing schema but not in DB Preserved

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

dbt_schemify-0.1.0.tar.gz (20.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dbt_schemify-0.1.0-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dbt_schemify-0.1.0.tar.gz
  • Upload date:
  • Size: 20.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for dbt_schemify-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3c6794c20c10dc7e6dd42bbf4ea7a1504b7799f2ce1b9f881842beb4c4bc5021
MD5 4d985000890ed9d5323ea8f06c82a9c7
BLAKE2b-256 ebe108d0d48d0f2fd112e716b195f1f9a549172028b26dea6b15850a4da13122

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dbt_schemify-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for dbt_schemify-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b61f65e2e80cccf3ceb4a0f4e4a9e2f29dbc78e594a2ffbd1bfc548dddf6c220
MD5 61f01ea56b13cb32437b1e6eea3e86f6
BLAKE2b-256 d17775c213f9de90da54a735d479da07212b6ed8f84871ac565f7e6c4fe1eaca

See more details on using hashes here.

Supported by

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