Skip to main content

A lightweight SQL transformation tool for Databricks SQL

Project description

dbx-sql-runner

A lightweight, library-first SQL transformation tool for Databricks SQL, inspired by DBT.

Features

  • Simple SQL Models: Just write .sql files. No complex boilerplate.
  • Automated Dependency Management: Reference other models using {upstream_model} and let the runner build the DAG for you.
  • Environment Aware: Seamlessly switch between Dev and Prod using profiles.yml and Environment Variables.
  • Library Design: Import dbx_sql_runner in your Python scripts (great for Airflow/Databricks Jobs) or run it via CLI.

Installation

Local Development

To install the project in editable mode:

pip install -e .

Production

To install the package normally:

pip install .

Configuration (profiles.yml)

Create a profiles.yml file to store your credentials. Do not commit this file to version control.

server_hostname: "dbc-xxxxxxxx-xxxx.cloud.databricks.com"
http_path: "/sql/1.0/warehouses/xxxxxxxxxxxxxxxx"
access_token: "${DBX_ACCESS_TOKEN}"  # Use env vars for security!
catalog: "my_catalog"
schema: "my_schema"
sources:
    my_source: "prod_catalog.schema.table"

Usage

1. CLI (Easiest)

Run your project from the command line. By default, it looks for profiles.yml in the current directory.

# Run with default profile (profiles.yml)
dbx-sql-runner run

# Run with custom profile
dbx-sql-runner run --profile my_config.yml

# Preview execution plan
dbx-sql-runner build

2. Python (Advanced)

For fine-grained control (e.g., inside a Databricks Job):

from dbx_sql_runner.api import run_project

# Run models in the 'models/' directory using the config from 'profiles.yml'
run_project(models_dir="models", config_path="profiles.yml")

Project Structure

.
├── models/                  # SQL files (.sql)
│   └── example.sql
├── dbx_sql_runner/          # Library source code
│   ├── adapters/            # Database Adapters
│   ├── project.py           # Model Loading & DAG
│   └── runner.py            # Execution Orchestrator
├── profiles.yml             # Configuration (gitignored)
├── pyproject.toml           # Project metadata
└── README.md

Defining Models

Create .sql files in your models/ directory.

  • Use header comments for metadata.
  • Use {upstream_model} syntax for references (automatically infers dependency).
-- name: my_table
-- materialized: table
-- partition_by: date, region

SELECT * FROM {source_view}
WHERE id > 100

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

dbx_sql_runner-0.1.0.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

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

dbx_sql_runner-0.1.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dbx_sql_runner-0.1.0.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dbx_sql_runner-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3127f17bc0255b2cc32cb5a277d3a83fee5c46d8d55145589e5467258483310b
MD5 8ee69446ec85657d4a0cd3d025a2ae3a
BLAKE2b-256 fee63d899287a4e3845cce8e09b9955c548cbfa72fb1c7c1f5e251bfa7db9e95

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbx_sql_runner-0.1.0.tar.gz:

Publisher: publish.yml on munish7771/dbx-sql-runner

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

File details

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

File metadata

  • Download URL: dbx_sql_runner-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dbx_sql_runner-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d877e58e05666a8f6abffba71774f29416e60ac73a97345a57ec58dfa9815639
MD5 d28e55ef1e7e6dd700c34f0a05a05247
BLAKE2b-256 2b3f96c3a9bb9bab04c29b73b960bff921e52108e28e2ad0812541da39c02b48

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbx_sql_runner-0.1.0-py3-none-any.whl:

Publisher: publish.yml on munish7771/dbx-sql-runner

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