Fabric notebook dbt job runner (clone + run + persist) on top of the official dbt-fabricspark adapter.
Project description
vdstudio-dbtfabric-notebook
A thin dbt job runner for Microsoft Fabric notebooks, built on top of the
official dbt-fabricspark adapter.
A Fabric deploy notebook installs this package and makes a single call —
run_dbt_job(config) — which clones the dbt project over SSH using a
deploy key fetched from the attached lakehouse, runs the dbt command(s),
and persists logs and artifacts to the lakehouse.
Install
pip install vdstudio-dbtfabric-notebook
The Fabric notebook runtime must also have dbt-core and dbt-fabricspark
available (the runner shells out to the dbt CLI). No other runtime
dependencies — the package has zero third-party Python deps.
Use
Inside a Fabric notebook:
from vdstudio_dbtfabric_notebook import (
run_dbt_job,
DbtJobConfig,
RepoConfig,
ConnectionConfig,
)
config = DbtJobConfig(
command=["dbt deps", "dbt build --target prod"],
repo=RepoConfig(
url="git@github.com:org/repo.git",
branch="main",
deploy_key_onelake_path="Files/_studio/<domain-slug>/deploy-keys/<repo>.id_ed25519",
),
connection=ConnectionConfig(
lakehouse_name=lakehouse_name,
lakehouse_id=lakehouse_id,
workspace_id=workspace_id,
workspace_name=workspace_name,
schema_name=schema_name,
),
)
result = run_dbt_job(config)
What it does
run_dbt_job(config):
- Environment setup — sets
LAKEHOUSE,LAKEHOUSE_ID,SCHEMA,WORKSPACE_ID,WORKSPACE_NAME,DBT_JOB_NAMEso the cloned project'sprofiles.ymlresolves viaenv_var(). - Clone over SSH — reads the deploy key from
/lakehouse/default/<deploy_key_onelake_path>(the notebook's attached default lakehouse is mounted there by Fabric), copies it to a0600temp file, and runsgit clone --depth 1 --branch <branch>withGIT_SSH_COMMANDconfigured to use that key. The temp key is deleted immediately after, even on failure. - Run —
dbt deps, then the dbt command(s) in order. Logs are emitted as JSON;dbt.log,run_results.json, andmanifest.jsonare persisted to/lakehouse/default/Files/logs/dbt/{YYYY}/{MM}/{DD}/{invocation_id}/.
Commands can be a single string or a list run sequentially; the returned
DbtResult is from the last command.
OneLake deploy-key convention
<lakehouse>/Files/_studio/<domain-slug>/deploy-keys/<repo-name>.id_ed25519
- One read-only deploy key per repo, generated and uploaded by studio at provisioning time.
- The notebook never sees the GitHub App PEM. It only reads back the per-repo private key from the lakehouse it's attached to.
deploy_key_onelake_pathis interpreted relative to/lakehouse/default/unless an absolute path is supplied.
Ephemeral validation
The runner consumes whatever ConnectionConfig, branch, and command
it is given. A wrapper pipeline can override the lakehouse/workspace
parameters, the branch, and swap --target prod for an ephemeral target
to validate against a throwaway lakehouse — no code change required.
Security
- No PEM and no Key Vault calls anywhere. The notebook's only secret exposure is the per-repo deploy key, scoped read-only.
- The staged temp key has
0600permissions and is deleted in afinallyblock before the function returns. - SSH host verification uses
StrictHostKeyChecking=accept-newwith a per-cloneUserKnownHostsFile(/tmp/known_hosts_deploy). Pin the github.com fingerprint there if you want stricter guarantees.
Development
pip install -e ".[dev]"
pytest
License
Apache-2.0
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 vdstudio_dbtfabric_notebook-0.2.0.tar.gz.
File metadata
- Download URL: vdstudio_dbtfabric_notebook-0.2.0.tar.gz
- Upload date:
- Size: 20.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1f232303819ee9e3928768aab99fb2d656dbd565ef0233fc8a79fc903352871
|
|
| MD5 |
8f46763ad01839a7139cfba80a8e037b
|
|
| BLAKE2b-256 |
f7684f37c3d179af140cb033cc038de4cfd99de4ebf9f3ed4953d7da8926885a
|
File details
Details for the file vdstudio_dbtfabric_notebook-0.2.0-py3-none-any.whl.
File metadata
- Download URL: vdstudio_dbtfabric_notebook-0.2.0-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f1e6a612dd2251b41fd5379ad88a82a6a8c2b378e06cb20375aeadd75fca289
|
|
| MD5 |
71192b1fc7f7c5919abbc1321b695ba0
|
|
| BLAKE2b-256 |
055f639ba01022411c15b082e96755653a7494fd13384a04b0111d6b67268642
|