<#6205 [BUG] structured dataset (constructed by da...
# flyte-github
c
#6205 [BUG] structured dataset (constructed by dataframe but not uri) in dataclass will fail in attribute access Issue created by Future-Outlier ### Describe the bug the below error will show. The above exception was the direct cause of the following exception: ╭───────────────────── Traceback (most recent call last) ──────────────────────╮ │ /Users/future-outlier/code/dev/flytekit/build/PR/pr_3027_sd.py:47 in │ │ <module> │ │ │ │ ❱ 47 │ print(wf()) │ │ │ │ /Users/future-outlier/code/dev/flytekit/flytekit/core/workflow.py:299 in │ │ call │ │ │ │ ❱ 299 │ │ self.compile() │ │ │ │ /Users/future-outlier/code/dev/flytekit/flytekit/core/workflow.py:804 in │ │ compile │ │ │ │ ❱ 804 │ │ │ │ raise FlyteValidationException( │ ╰──────────────────────────────────────────────────────────────────────────────╯ FlyteValidationException: USERValidationError error=Failed to bind output o0 for function pr_3027_sd.wf: 'Promise' object has no attribute 'uri', cause='Promise' object has no attribute 'uri' ### Expected behavior it should work. ### Additional context to reproduce
Copy code
from flytekit import task, workflow, ImageSpec
from flytekit.types.structured.structured_dataset import StructuredDataset
import pandas as pd
from dataclasses import dataclass


flytekit_hash = "master"
flytekit = f"git+https://github.com/flyteorg/flytekit.git@{flytekit_hash}"

custom_image = ImageSpec(packages=[flytekit, "pandas", "pyarrow"],
                            apt_packages=["git"],
                            registry="futureoutlier",
                            env={"FLYTE_SDK_LOGGING_LEVEL": 10},
                         )

@dataclass
class DC:
    sd: StructuredDataset


@task(container_image=custom_image)
def create_pd_sd_dc() -> DC:
    return DC(sd=StructuredDataset(
        dataframe=pd.DataFrame(
            {
                "calories": [420, 380, 390],
                "duration": [50, 40, 45]
            }
        ),
        file_format="parquet"
    ))


@task(container_image=custom_image)
def return_pd_sd(sd: StructuredDataset) -> StructuredDataset:
    return sd


@workflow
def wf() -> DC:
    dc = create_pd_sd_dc()
    sd = return_pd_sd(dc.sd)
    return DC(sd=sd)


if __name__ == "__main__":
    print(wf())
### Screenshots [Image](https://private-user-images.githubusercontent.com/76461262/408675744-844d1933-0b1f-468e-96bb-015d6ff112f1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDg2NTA0ODIsIm5iZiI6MTc0ODY1MDE4MiwicGF0aCI6Ii83NjQ2MTI2Mi80MDg2NzU3NDQtODQ0ZDE5MzMtMGIxZi00NjhlLTk2YmItMDE1ZDZmZjExMmYxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA1MzElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwNTMxVDAwMDk0MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTA5MmU2ZWZlNWU5ZWRmMTAwOTM2YTg0YjNiN2IxYjU4ZWYxZDJlNDQzYjU0ODExYjJiNGQxYWI1NDJjZTAwNzkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.MDrPdIcExlrsr_C2buyhT6gOuzd8cXjqIFgNRoid7pE) ### Are you sure this issue hasn't been raised already? • Yes ### Have you read the Code of Conduct? • Yes flyteorg/flyte