Skip to content

Commit 7764d6d

Browse files
committed
Fix asset loader for sourceassets
1 parent fd27b7c commit 7764d6d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

python_modules/dagster/dagster/_core/definitions/module_loaders/object_list.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -349,11 +349,7 @@ def with_attributes(
349349
else new_asset
350350
)
351351
elif isinstance(dagster_def, SourceAsset):
352-
return_list.append(
353-
dagster_def.with_attributes(
354-
group_name=group_name if group_name else dagster_def.group_name
355-
)
356-
)
352+
return_list.append(dagster_def.with_attributes(group_name=group_name))
357353
elif isinstance(dagster_def, AssetSpec):
358354
return_list.append(
359355
_spec_mapper_disallow_group_override(group_name, automation_condition)(

python_modules/dagster/dagster/_core/definitions/source_asset.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,9 +460,13 @@ def with_resources(self, resource_defs) -> "SourceAsset":
460460
def with_attributes(
461461
self, group_name: Optional[str] = None, key: Optional[AssetKey] = None
462462
) -> "SourceAsset":
463-
if group_name is not None and self.group_name != DEFAULT_GROUP_NAME:
463+
if (
464+
group_name is not None
465+
and self.group_name != DEFAULT_GROUP_NAME
466+
and self.group_name != group_name
467+
):
464468
raise DagsterInvalidDefinitionError(
465-
"A group name has already been provided to source asset"
469+
f"Attempted to override group name to {group_name} for SourceAsset {self.key.to_user_string()}, which already has group name {self.group_name}."
466470
f" {self.key.to_user_string()}"
467471
)
468472

0 commit comments

Comments
 (0)