Samuel Stütz
08/10/2022, 2:04 PMVinnie
08/11/2022, 7:00 AMrequired_resource_keys
and inside the function, which is not ideal, but works. See following:
@asset(required_resource_keys={"foo_one"})
def one(context):
return context.resources.foo_one.run()
@asset(required_resource_keys={"foo_two"})
def two(context):
return context.resources.foo_two.run()
@repository
def repo():
return [*with_resources(
definitions=[one, two],
resource_defs={"foo_one": foo, "foo_two": foo},
resource_config_by_key={"foo_one": {"config": {}},
"foo_two": {"config": {}}})]
What I dislike about this is having to also change the resource attribute name. When the computations behind the assets are similar enough, I’m used to building them in a more abstracted way and simply passing different configs that lead to different assets (say I’m fetching campaigns or ad groups from GAds, here changing a few parameters in the config would already do the trick). Would be great to see some improvement there.
For now I’m mostly sticking to `AssetMaterialization`s. SDAs are a fantastic concept and I’m excited to see it progress, but it’s not as flexible as I’d like.claire
08/11/2022, 7:28 PMreturn [*with_resources(
definitions=[one, two],
resource_defs={"foo_one": foo.configured({...}), "foo_two": foo.configured{...}})]
But that being said, it still doesn’t avoid the clunkiness of having to change the resource attribute name. Providing ways to inject unique config for each asset’s resources sounds like what we need here