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
.sqlfiles. 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.ymland Environment Variables. - Library Design: Import
dbx_sql_runnerin 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3127f17bc0255b2cc32cb5a277d3a83fee5c46d8d55145589e5467258483310b
|
|
| MD5 |
8ee69446ec85657d4a0cd3d025a2ae3a
|
|
| BLAKE2b-256 |
fee63d899287a4e3845cce8e09b9955c548cbfa72fb1c7c1f5e251bfa7db9e95
|
Provenance
The following attestation bundles were made for dbx_sql_runner-0.1.0.tar.gz:
Publisher:
publish.yml on munish7771/dbx-sql-runner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dbx_sql_runner-0.1.0.tar.gz -
Subject digest:
3127f17bc0255b2cc32cb5a277d3a83fee5c46d8d55145589e5467258483310b - Sigstore transparency entry: 813994462
- Sigstore integration time:
-
Permalink:
munish7771/dbx-sql-runner@ab8ee929ff9963f16505d85ab51ff0d1db1902d3 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/munish7771
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ab8ee929ff9963f16505d85ab51ff0d1db1902d3 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d877e58e05666a8f6abffba71774f29416e60ac73a97345a57ec58dfa9815639
|
|
| MD5 |
d28e55ef1e7e6dd700c34f0a05a05247
|
|
| BLAKE2b-256 |
2b3f96c3a9bb9bab04c29b73b960bff921e52108e28e2ad0812541da39c02b48
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dbx_sql_runner-0.1.0-py3-none-any.whl -
Subject digest:
d877e58e05666a8f6abffba71774f29416e60ac73a97345a57ec58dfa9815639 - Sigstore transparency entry: 813994463
- Sigstore integration time:
-
Permalink:
munish7771/dbx-sql-runner@ab8ee929ff9963f16505d85ab51ff0d1db1902d3 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/munish7771
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ab8ee929ff9963f16505d85ab51ff0d1db1902d3 -
Trigger Event:
release
-
Statement type: