Skip to content

Instantly share code, notes, and snippets.

@pingsutw
Created March 1, 2022 10:04
Show Gist options
  • Save pingsutw/cd3e53905aba6b2073b11ad72c900b14 to your computer and use it in GitHub Desktop.
Save pingsutw/cd3e53905aba6b2073b11ad72c900b14 to your computer and use it in GitHub Desktop.
from flytekit import task, StructuredDataset, workflow
import pandas as pd
import pyarrow as pa
df = pd.DataFrame({"Name": ["Tom", "Joseph"], "Age": [1, 22], "Height": [160, 178]})
padf = pa.Table.from_pandas(pd.DataFrame({"Name": ["Tom", "Joseph"], "Age": [20, 22]}))
@task
def t1() -> StructuredDataset:
return StructuredDataset(dataframe=padf, uri="gs://flyte-private/")
@task
def t2(sd: StructuredDataset):
print(sd.open(pa.Table).all())
@workflow
def wf():
t2(sd=t1())
wf()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment