flyteplugins-dbt
Run dbt CLI invocations as Flyte v2 tasks.
DbtTask maps one dbtRunner.invoke(...) call to one Flyte task. Project-level dbt paths are configured on the task, and invocation-level options are task inputs.
Install the dbt adapter required by your project, such as dbt-duckdb, dbt-bigquery, or dbt-snowflake, in the task image alongside this plugin.
from pathlib import Path
import flyte
from flyteplugins.dbt import DbtTask
DBT_PROJECT_DIR = "jaffle_shop"
DBT_PROFILES_DIR = "dbt-profiles"
env = flyte.TaskEnvironment(
name="dbt",
image=flyte.Image.from_debian_base()
.with_requirements("requirements.txt")
.with_source_folder(Path(DBT_PROJECT_DIR))
.with_source_folder(Path(DBT_PROFILES_DIR)),
)
dbt_test = DbtTask(
name="dbt-test",
task_environment=env,
project_dir=DBT_PROJECT_DIR,
profiles_dir=DBT_PROFILES_DIR,
profile=DBT_PROJECT_DIR,
report=True,
)
@env.task
async def main():
return await dbt_test.aio(command="test", select=["stg_orders+"], target="prod")
Multi-token dbt commands can be passed as a shell-style string or as explicit tokens:
await dbt_test.aio(command="docs generate")
await dbt_test.aio(command=["source", "freshness"])
The task returns a list of DbtNodeResult values summarized from dbt node results. If dbt reports failure, the task raises the dbt exception when one is available, otherwise it raises DbtInvocationError with the summarized node results.
When report=True, the task writes a dbt report tab with node names, resource types, statuses, failures, execution times, and messages. The report is written before dbt failures are raised, so failed dbt runs can still show succeeded and failed node results.
Event callbacks
Custom dbt event callbacks can be passed to DbtTask.
def log_dbt_node(event):
data = getattr(event, "data", None)
node_info = getattr(data, "node_info", None)
if node_info is None:
return
node_name = getattr(node_info, "node_name", None)
node_status = getattr(node_info, "node_status", None)
print(f"dbt node={node_name} status={node_status}")
dbt_test = DbtTask(
name="dbt-test",
task_environment=env,
callbacks=[log_dbt_node],
)
For remote execution, callbacks must be importable functions. Import-path strings are also supported:
dbt_test = DbtTask(
name="dbt-test",
task_environment=env,
callbacks=["my_project.callbacks.log_dbt_node"],
)
Metadata
Release files for flyteplugins-dbt 2.12.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flyteplugins_dbt-2.12.3-py3-none-any.whl | Python 3 | none | any | Details for flyteplugins_dbt-2.12.3-py3-none-any.whl |
Release files / flyteplugins_dbt-2.12.3-py3-none-any.whl
| Download URL | flyteplugins_dbt-2.12.3-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
77dfca47a1b926808f6f21c5db359e36f488f5808c7246b658107ef5e6d470b4
|
|
BLAKE2b-256 checksum How to use checksums |
ddb6473c0eaf506d823eb9bef07846ded4b1dcae0cc0d7b20cadc0e1284b17e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.17
|
Security for flyteplugins-dbt 2.12.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.