Fanny Wiryana
09/06/2022, 11:20 AMload_assets_from_dbt_project()
, but Asset is not found. it is not showing up in the console where in my local I can see the lineage.
dagster version = 0.15.8
deployment in ubuntu compute engine VM GCPdagster_repo
+ dbt_repository.py
dbt
+ config
+ dbt_project.yml
+ profile.yml
+ model
+ macros
in dbt_repository.py, the code looks like this 👇
DBT_PROJECT_DIR = '/{ROOT_DIR}/dbt/config'
DBT_PROFILES_DIR = '/{ROOT_DIR}/dbt/config'
dbt_assets = load_assets_from_dbt_project(
DBT_PROJECT_DIR,
profiles_dir=DBT_PROFILES_DIR,
use_build_command=True,
select="'*'"
)
yuhan
09/06/2022, 6:12 PMFanny Wiryana
09/07/2022, 2:35 AMyuhan
09/07/2022, 3:46 AMrepository
definition? did you include dbt_assets
in it or did you use things like load_assets_from_package_module
to load the entire module/package?Fanny Wiryana
09/07/2022, 3:48 AMload_asset_from_dbt_project
and,
data_a = define_asset_job("data_a",
selection=AssetSelection.keys(
AssetKey(["data_a", "data_a"])))
call the asset like this ☝️@repository
def transformation_layer():
return with_resources(
dbt_assets,
resource_defs={
"dbt": dbt_cli_resource.configured(
{"project_dir": DBT_PROJECT_DIR, "profiles_dir": DBT_PROFILES_DIR}
),
},
)
yuhan
09/07/2022, 4:00 AMdbt_assets = load_assets_from_dbt_project(
DBT_PROJECT_DIR,
profiles_dir=DBT_PROFILES_DIR,
use_build_command=True,
select="'*'"
)
you had
select="'*'"
was it intentional to select '*'
as opposed to *
?Fanny Wiryana
09/07/2022, 4:01 AMdbt_assets = load_assets_from_dbt_project(
DBT_PROJECT_DIR,
profiles_dir=DBT_PROFILES_DIR,
)
also not working.yuhan
09/07/2022, 4:03 AMDBT_PROJECT_DIR = '/{ROOT_DIR}/dbt/config'
should be
DBT_PROJECT_DIR = '/{ROOT_DIR}/dbt'
Fanny Wiryana
09/07/2022, 4:39 AMdagster_dbt.errors.DagsterDbtCliFatalRuntimeError: Fatal error in the dbt CLI (return code 2)
File "/home/ubuntu/.local/lib/python3.8/site-packages/dagster/_grpc/server.py", line 227, in __init__
self._loaded_repositories = LoadedRepositories(
File "/home/ubuntu/.local/lib/python3.8/site-packages/dagster/_grpc/server.py", line 101, in __init__
loadable_targets = get_loadable_targets(
File "/home/ubuntu/.local/lib/python3.8/site-packages/dagster/_grpc/utils.py", line 33, in get_loadable_targets
else loadable_targets_from_python_file(python_file, working_directory)
File "/home/ubuntu/.local/lib/python3.8/site-packages/dagster/_core/workspace/autodiscovery.py", line 26, in loadable_targets_from_python_file
loaded_module = load_python_file(python_file, working_directory)
File "/home/ubuntu/.local/lib/python3.8/site-packages/dagster/_core/code_pointer.py", line 86, in load_python_file
return import_module_from_path(module_name, python_file)
File "/home/ubuntu/.local/lib/python3.8/site-packages/dagster/_seven/__init__.py", line 51, in import_module_from_path
spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 848, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/opt/dagster/repo_sync/data_engineering/dbt_repository.py", line 20, in <module>
dbt_assets = load_assets_from_dbt_project(
File "/home/ubuntu/.local/lib/python3.8/site-packages/dagster_dbt/asset_defs.py", line 424, in load_assets_from_dbt_project
manifest_json, cli_output = _load_manifest_for_project(
File "/home/ubuntu/.local/lib/python3.8/site-packages/dagster_dbt/asset_defs.py", line 41, in _load_manifest_for_project
cli_output = execute_cli(
File "/home/ubuntu/.local/lib/python3.8/site-packages/dagster_dbt/cli/utils.py", line 139, in execute_cli
raise DagsterDbtCliFatalRuntimeError(
yuhan
09/07/2022, 4:51 AMFanny Wiryana
09/07/2022, 5:21 AMDBT_PROJECT_DIR = file_relative_path(__file__, "../dbt/config")
DBT_PROFILES_DIR = file_relative_path(__file__, "../dbt/config")
but still did not work (no Asset loaded to the repository). do u think its because of version?
I use 0.15.8yuhan
09/07/2022, 6:46 AMDBT_PROJECT_DIR = file_relative_path(__file__, "../dbt") # this should point to the dbt project folder, not the config folder
DBT_PROFILES_DIR = file_relative_path(__file__, "../dbt/config")
Fanny Wiryana
09/07/2022, 7:21 AMdagster_dbt.errors.DagsterDbtCliFatalRuntimeError: Fatal error in the dbt CLI (return code 2)
yuhan
09/07/2022, 6:42 PMowen
09/07/2022, 9:55 PMdagit -f path/to/dbt_repository.py
), to view the logs there