https://prefect.io logo
Title
d

Dominik Jagoda

04/03/2023, 7:43 AM
Hi, I have created a deployment flow retrieving currency rates in prefect 2. The flow takes several parameters including a date range to retrieve in the form of
start_date
and
end_date
. The default is set to today's date using the function
datetime.today().strftime("%Y-%m-%d")
. When I create a deployment, the above function executes and sets the date as today's date, e.g.
03-04-2023
. The problem is that this date will be set all the time every time I run the flow tomorrow, next week and next month. Is there any functionality in prefect where I could specify a parameter e.g. prefect.today() which would set the current date each time the flow is executed. Flow params set in deployment
{
"symbols": [
"USD",
"EUR",
"GBP",
"CHF",
"PLN",
"DKK",
"COP",
"CZK",
"SEK",
"NOK",
"ISK"
],
"currency": "USD",
"end_date": "2023-03-24",
"if_exists": "replace",
"start_date": "2023-03-24",
"databricks_table": "exchange_rates",
}