https://dagster.io/ logo
#integration-dbt
Title
# integration-dbt
a

André Augusto

03/29/2023, 10:32 PM
Do someone who has
dbt
assets loaded as jobs in dagster (using
define_asset_job
) tried to upgrade to Dagster
>= 1.2.3
? I have been using
1.2.2
but cannot upgrade further; in both versions I’m faced with the message in the comments. Going through the changelog it doesnt seem that I have to change my code. Perhaps this PR introduced a bug?
🤖 1
Stack trace:
Copy code
dagster_daemon    | /usr/local/lib/python3.10/site-packages/dagster/_core/workspace/context.py:591: UserWarning: Error loading repository location definitions.py:dagster._check.CheckError: Invariant failed. Description: Tried to retrieve asset key from an assets definition with multiple asset keys: **__REDACTED__**
dagster_daemon    | 
dagster_daemon    | Stack Trace:
dagster_daemon    |   File "/usr/local/lib/python3.10/site-packages/dagster/_grpc/server.py", line 266, in __init__
dagster_daemon    |     self._loaded_repositories: Optional[LoadedRepositories] = LoadedRepositories(
dagster_daemon    |   File "/usr/local/lib/python3.10/site-packages/dagster/_grpc/server.py", line 115, in __init__
dagster_daemon    |     loadable_targets = get_loadable_targets(
dagster_daemon    |   File "/usr/local/lib/python3.10/site-packages/dagster/_grpc/utils.py", line 37, in get_loadable_targets
dagster_daemon    |     else loadable_targets_from_python_file(python_file, working_directory)
dagster_daemon    |   File "/usr/local/lib/python3.10/site-packages/dagster/_core/workspace/autodiscovery.py", line 27, in loadable_targets_from_python_file
dagster_daemon    |     loaded_module = load_python_file(python_file, working_directory)
dagster_daemon    |   File "/usr/local/lib/python3.10/site-packages/dagster/_core/code_pointer.py", line 83, in load_python_file
dagster_daemon    |     return import_module_from_path(module_name, python_file)
dagster_daemon    |   File "/usr/local/lib/python3.10/site-packages/dagster/_seven/__init__.py", line 49, in import_module_from_path
dagster_daemon    |     spec.loader.exec_module(module)
dagster_daemon    |   File "<frozen importlib._bootstrap_external>", line 883, in exec_module
dagster_daemon    |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
dagster_daemon    |   File "/app/orchestration/definitions.py", line 3, in <module>
dagster_daemon    |     from jobs import ASSETS_JOBS, JOBS
dagster_daemon    |   File "/app/orchestration/jobs/__init__.py", line 3, in <module>
dagster_daemon    |     from .dbt_assets import *
dagster_daemon    |   File "/app/orchestration/jobs/dbt_assets.py", line 5, in <module>
dagster_daemon    |     hourly_assets_job = define_asset_job(
dagster_daemon    |   File "/usr/local/lib/python3.10/site-packages/dagster/_core/definitions/unresolved_asset_job_definition.py", line 398, in define_asset_job
dagster_daemon    |     resolved_selection = AssetSelection.keys(
dagster_daemon    |   File "/usr/local/lib/python3.10/site-packages/dagster/_core/definitions/unresolved_asset_job_definition.py", line 399, in <genexpr>
dagster_daemon    |     *(el.key for el in cast(Sequence[Union[AssetsDefinition, SourceAsset]], selection))
dagster_daemon    |   File "/usr/local/lib/python3.10/site-packages/dagster/_core/definitions/assets.py", line 583, in key
dagster_daemon    |     check.invariant(
dagster_daemon    |   File "/usr/local/lib/python3.10/site-packages/dagster/_check/__init__.py", line 1654, in invariant
dagster_daemon    |     raise CheckError(f"Invariant failed. Description: {desc}")
s

sandy

03/29/2023, 11:23 PM
@sean - getting this on your radar in case you haven't seen it already
a

Aksel Stokseth

03/30/2023, 9:11 AM
I got the same issue on upgrade to 1.2.3 and I think I have a good minimal repro here. (not dbt, but the same error)
s

sean

03/30/2023, 4:03 PM
Do you both have this problem still on 1.2.4? My first thought is that this may be caused by
AssetSelection.groups
, for which a bugfix went out yesterday
a

Abhishek Agrawal

03/30/2023, 4:19 PM
I can confirm that I faced this issue yesterday but not sure what was the latest version then. Will check and report back here.
a

André Augusto

03/30/2023, 5:05 PM
I can confirm that this error still happens in
1.2.4
. Using the minimal example that @Aksel Stokseth laid above, I got the error (see attached image)
plus1 1
s

sean

03/30/2023, 9:29 PM
daggy love 1
a

Abhishek Agrawal

03/30/2023, 10:45 PM
So we need to get the latest version then?
a

Aksel Stokseth

03/31/2023, 6:27 AM
Blazingly fast sonic thanks so much @sandy and @sean! daggy love
s

sean

03/31/2023, 12:00 PM
@Abhishek Agrawal this fix is not in the latest version (1.2.4), it will be released next week