NateV
03/31/2023, 1:34 PMasset
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?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?
@op
def send_emails(emails) -> None:
...
@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