chore: restructure python
This commit is contained in:
19
data_platform/assets/dbt.py
Normal file
19
data_platform/assets/dbt.py
Normal file
@@ -0,0 +1,19 @@
|
||||
"""dbt assets for the data platform."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from dagster import AssetExecutionContext
|
||||
from dagster_dbt import DbtCliResource, DbtProject, dbt_assets
|
||||
|
||||
DBT_PROJECT_DIR = Path(__file__).parent.parent.parent / "dbt"
|
||||
|
||||
dbt_project = DbtProject(project_dir=str(DBT_PROJECT_DIR))
|
||||
|
||||
# When running locally outside Docker, generate/refresh the manifest automatically.
|
||||
dbt_project.prepare_if_dev()
|
||||
|
||||
|
||||
@dbt_assets(manifest=dbt_project.manifest_path)
|
||||
def dbt_project_assets(context: AssetExecutionContext, dbt: DbtCliResource):
|
||||
"""Every dbt model/test/snapshot becomes a Dagster asset."""
|
||||
yield from dbt.cli(["build"], context=context).stream()
|
||||
Reference in New Issue
Block a user