Returns set of definitions explicitly available and loadable by Dagster tools.
Will be automatically dectectd and loaded by the load_defs function in the root
definitions file.
@definitions decorator will provides lazy loading so that the assets are only
instantiated when needed.
Source code in data_platform\defs\dbt\definitions.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 | @definitions
def defs() -> Definitions:
"""Returns set of definitions explicitly available and loadable by Dagster tools.
Will be automatically dectectd and loaded by the load_defs function in the root
definitions file.
@definitions decorator will provides lazy loading so that the assets are only
instantiated when needed.
"""
project_dir = Path(__file__).joinpath(*[".."] * 4, "dbt/").resolve()
state_path = "state/"
def dbt() -> DbtProject:
project = DbtProject(
project_dir=project_dir,
target=os.getenv("TARGET", "prod"),
state_path=state_path,
profile="dbt",
)
if os.getenv("PREPARE_IF_DEV") == "1":
project.prepare_if_dev()
return project
return DagsterDbtFactory.build_definitions(dbt)
|