Hi Team! Tell me please how can I pass Asset to th...
# ask-community
r
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
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
+1 to Zach's comment above. Assets currently cannot be passed into ops--you'd have to create some downstream asset
🙏 1