<#6117 [BUG] Cannot return StructuredDataset which...
# flytekit
c
#6117 [BUG] Cannot return StructuredDataset which is a field in a dataclass Issue created by gvogel-hh ### Describe the bug The following code fails in the
extract
task with
AttributeError: 'StructuredDataset' object has no attribute 'to_flyte_idl'
.
Copy code
@dataclass
class Data:
    f: StructuredDataset


@task
def create_data() -> Data:
    return Data(f=StructuredDataset(dataframe=pd.DataFrame({"a": [5]})))


@task
def extract(d: Data) -> StructuredDataset:
    return d.f


@workflow
def example_wf() -> None:
    d = create_data()
    f = extract(d=d)
It is possible to work around the issue by returning
StructuredDataset(dataframe=d.f.open(pd.DataFrame).all())
instead. ### Expected behavior The field value should be returned by the task. ### Additional context to reproduce No response ### Screenshots No response ### Are you sure this issue hasn't been raised already? • Yes ### Have you read the Code of Conduct? • Yes flyteorg/flyte