I'm trying to run basically this example - <https:...
# ask-community
n
I'm trying to run basically this example - https://docs.dagster.io/concepts/ops-jobs-graphs/graphs#loading-an-asset-as-an-input, loading an asset as an input to a graph. An
asset
definition returns an Output with a pandas Dataframe for its value. Then I try to pass it to an
op
that takes a dataframe and does some work to send emails based on the contents of the dataframe. But when I write a
graph
like the one in this example , I get a type error
Argument of type "SourceAsset" cannot be assigned to parameter "df" of type "DataFrame
. And at runtime, i get an error from the
op
that
'SourceAsset' object has no attribute 'to_string'
. So the
op
is getting a SourceAsset, not the value of the asset. All the
op
examples just show the asset value getting passed directly as a parameter. So ... Do I need to do something in the
graph
to get the Dataframe from the
SourceAsset
returned from my
asset
? Or does the
op
need to take a
SourceAsset
instead of a
DataFrame
and do something to get the DataFrame out of the SourceAsset?
Like in this snippet from the example, what's the type of
emails
? is it the asset's value, like a dataframe or list, or is it a SourceAsset that the
op
needs to ... materialize or something?
Copy code
@op
def send_emails(emails) -> None:
    ...
alright - i got it. One mistake was a silly one, I'd accidentally deleted or forgotten the
@op
decorator on the email-sending op. but it also turns out the coercion of a SourceAsset to the asset value means I can't pass other non-source assets to the op function (like strings or whatever). Not sure what that means me. Maybe i need to some sort of OpBuilder currying thing to make an op dynamically