Skip to content

Instantly share code, notes, and snippets.

@kvnkho
Last active May 28, 2022 04:18
Show Gist options
  • Select an option

  • Save kvnkho/5dc7cc549fa25290ee4a2d15e61126ba to your computer and use it in GitHub Desktop.

Select an option

Save kvnkho/5dc7cc549fa25290ee4a2d15e61126ba to your computer and use it in GitHub Desktop.
# Prefect 1.0
@task
def get_date(day: str):
if day == "today":
return datetime.date.today()
else:
# assume a string came in
return datetime.datetime.strptime(day, '%Y-%m-%d').date()
with Flow("basic") as flow:
today = Parameter("today", default="today")
today_parsed = get_date(today)
e = extract(today_parsed)
t = transform(e)
l = load(t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment