Generate dbt staging models for 4PS Construct (Business Central) from bc2adls CDM manifests
Project description
dbt-4ps-generator
CLI that generates dbt staging models from a bc2adls CDM export. For every entity in the manifest it writes:
stg_4ps__<table>.sql— aSELECT ... FROM STREAM READ_FILES(...)model with the column types from the CDM metadata and columns renamed to snake_case (CreditLimitLCY-20→credit_limit_lcy)_4ps__models.yaml— model + column descriptions, and adbt_utils.unique_combination_of_columnstest on each table's primary key
Full documentation: https://misja-pronk.github.io/dbt-4ps-staging/
Install
uvx dbt-4ps-generator --help # run once, ephemerally
uv tool install dbt-4ps-generator # install the command on PATH
Or from a checkout: uv run dbt-4ps-generator in this directory.
Usage
Download the CDM metadata from the Unity Catalog volume bc2adls exports to (authenticates via DATABRICKS_HOST/DATABRICKS_TOKEN or a ~/.databrickscfg profile):
dbt-4ps-generator download \
--volume-path /Volumes/<catalog>/<schema>/<volume> \
--output-directory ../_cdm
Generate the models:
dbt-4ps-generator generate \
--manifest ../_cdm/deltas.manifest.cdm.json \
--output-directory ../dbt_4ps_staging_package/models/staging/4ps
Options (see --help): --model-prefix (default stg_4ps__), --schema-prefix (default _4ps__), and --no-file-metadata-column to omit the _metadata source-file column.
Development
uv sync
uv run pytest
uv run ruff check . && uv run ruff format --check .
uv run ty check
Layout
File (src/dbt_4ps_generator/) |
Purpose |
|---|---|
cli.py |
Typer CLI (generate, download) |
cdm.py |
Pydantic models for the CDM manifest and entity files |
converters.py |
CDM → dbt/SQL conversions (types, names, READ_FILES options) |
dbt.py |
Builders that write the .sql models and schema yaml |
sql.py |
SQL primitives (columns, options, streaming-table DDL builder) |
databricks_helper.py |
Volume download via the Databricks SDK |
Project details
Release history Release notifications | RSS feed
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 dbt_4ps_generator-0.1.1.tar.gz.
File metadata
- Download URL: dbt_4ps_generator-0.1.1.tar.gz
- Upload date:
- Size: 57.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4daf6a5d5afcc96befcd4816d015dea9c195dbb636ed4cf02819d882d5cf5f7a
|
|
| MD5 |
1e9173d22c355a39a5549c1125526d6c
|
|
| BLAKE2b-256 |
a1252615857e3a84d162d646e7973ad3bec50419edca2311fa455b1e422b59d9
|
File details
Details for the file dbt_4ps_generator-0.1.1-py3-none-any.whl.
File metadata
- Download URL: dbt_4ps_generator-0.1.1-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e31ea50eb076bf5f714fbe597409bb9a705b15eb401f69941bc8b32e51109eb
|
|
| MD5 |
b9b387c36887a862dfdff53c9645ade5
|
|
| BLAKE2b-256 |
8fc652f2c4ae1d791191ecd71c4296b5bcf3b8b3d6dd0ffd1fde632e4ce2c823
|