https://dagster.io/ logo
#ask-community
Title
# ask-community
r

Roman Maliushkin

06/01/2023, 1:15 PM
Hi Team! Tell me please how can I pass Asset to the Op? What I do:
Copy code
@op(
    ins={
        "some_asset": In(asset_key=AssetKey(["path"]))
    }
)
def some_op(context: OpExecutionContext, some_asset: DataFrame):
    <http://context.log.info|context.log.info>(some_asset.count())
What I get:
dagster._core.errors.DagsterInvariantViolationError: Attempting to access asset_key, but no asset is associated with this input
But I am sure I have an
asset_key
with key "path"
z

Zach

06/01/2023, 3:01 PM
Curious to hear what other people say, I didn't think you could pass assets into ops though - the workaround I've done in the past for this is to wrap the op in a graph-backed asset which takes the upstream asset as an input
2
🙏 1
c

claire

06/01/2023, 5:04 PM
+1 to Zach's comment above. Assets currently cannot be passed into ops--you'd have to create some downstream asset
🙏 1
5 Views