-
Getting a resource's dependent resource by name I'm using a factory function to create a resource, something like
The problem is in the line The question was originally asked in Dagster Slack. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You can use from dagster import op, job, ResourceDefinition
@op(required_resource_keys={"a", "b", "c"})
def my_op(context):
print(getattr(context.resources, "a")) # 1
print(getattr(context.resources, "b")) # 2
print(getattr(context.resources, "c")) # 3
@job(
resource_defs={
"a": ResourceDefinition.hardcoded_resource(1),
"b": ResourceDefinition.hardcoded_resource(2),
"c": ResourceDefinition.hardcoded_resource(3),
}
)
def my_job():
my_op() |
Beta Was this translation helpful? Give feedback.
You can use
getattr
, for example: