Skip to main content

Create or update dbt source YAML from BigQuery

Project description

dbt-bq-sourcegen

License: MIT Python 3.11+

Create or update dbt source YAML from BigQuery.

Overview

dbt-bq-sourcegen automatically generates dbt source YAML files from BigQuery schemas, preserving existing configurations during updates. It supports table filtering with wildcard patterns and maintains YAML formatting/comments. This tool streamlines the process of keeping dbt source definitions in sync with your BigQuery datasets.

Installation

pip install git+https://github.com/K-Oxon/dbt-bq-sourcegen.git

Usage

Apply (create or update automatically)

dbt-bq-sourcegen apply \
  --project-id your-project \
  --schema your_dataset \
  --output models/staging/your_dataset/src_your_dataset.yml

With table filtering

# Only include tables matching pattern
dbt-bq-sourcegen apply \
  --project-id your-project \
  --schema your_dataset \
  --table-pattern "stg_*" \
  --output models/staging/your_dataset/src_your_dataset.yml

# Exclude specific tables
dbt-bq-sourcegen apply \
  --project-id your-project \
  --schema your_dataset \
  --exclude "temp" \
  --output models/staging/your_dataset/src_your_dataset.yml

Options

  • --project-id: Google Cloud project ID (required)
  • --schema, --dataset: BigQuery schema/dataset name (required)
  • --output: Output YAML file path (required)
  • --table-pattern: Table name pattern (e.g., 'stg_*')
  • --exclude: Exclude tables containing this string

Features

  • Automatically generates dbt source YAML from BigQuery schema
  • Updates existing source YAML files while preserving custom configurations
  • Supports table filtering with wildcard patterns
  • Preserves YAML formatting and comments
  • Pure Python implementation with clean separation of concerns

Development

# Install development dependencies
uv sync

# Run tests
uv run pytest

# Format code
uv run ruff format src/

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_bq_sourcegen-0.1.1.tar.gz (60.7 kB view details)

Uploaded Source

Built Distribution

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

dbt_bq_sourcegen-0.1.1-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file dbt_bq_sourcegen-0.1.1.tar.gz.

File metadata

  • Download URL: dbt_bq_sourcegen-0.1.1.tar.gz
  • Upload date:
  • Size: 60.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for dbt_bq_sourcegen-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a38c29fd6fe60f05f811d789e5c8b878f4be77c5b06b434125da3cb440b86653
MD5 b62331d4b38948472c49d05a5c911a82
BLAKE2b-256 7a5d2bb822f634eb70e16cfe1f0734a7ec6c6f1d99de8f5179a636da776b2266

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbt_bq_sourcegen-0.1.1.tar.gz:

Publisher: release.yml on K-Oxon/dbt-bq-sourcegen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dbt_bq_sourcegen-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for dbt_bq_sourcegen-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 17cfd394565dd7457892e2307a354c10ea349d1421bb4750474f9733c7459354
MD5 284290a66e39950b2a05721789564ba3
BLAKE2b-256 eb237e798d800b20a448dab49625958d339a773dadafea408e875ea6d5e36995

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbt_bq_sourcegen-0.1.1-py3-none-any.whl:

Publisher: release.yml on K-Oxon/dbt-bq-sourcegen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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