Skip to content

Commit

Permalink
Add example for reference bigquery task (#1717)
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Su <[email protected]>
  • Loading branch information
pingsutw authored Aug 6, 2024
1 parent c8fed8b commit 65aa283
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions examples/productionizing/productionizing/reference_task.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import List
from typing import List, NamedTuple

from flytekit import reference_task, workflow
from flytekit import StructuredDataset, reference_task, workflow
from flytekit.types.file import FlyteFile

# A `flytekit.reference_task` references the Flyte tasks that have already been defined, serialized, and registered.
Expand All @@ -26,8 +26,22 @@ def normalize_columns(
...


outputs = NamedTuple("Outputs", results=StructuredDataset)


@reference_task(
project="flytesnacks",
domain="development",
name="bigquery",
version="{{ registration.version }}",
)
def bigquery_task(version: int) -> outputs:
...


@workflow
def wf() -> FlyteFile:
bigquery_task(version=1)
return normalize_columns(
csv_url="https://people.sc.fsu.edu/~jburkardt/data/csv/biostats.csv",
column_names=["Name", "Sex", "Age", "Heights (in)", "Weight (lbs)"],
Expand Down

0 comments on commit 65aa283

Please sign in to comment.