DR
07/17/2024, 8:44 AM{
"report_spec": {
"metrics": [
"ESTIMATED_EARNINGS"
],
"date_range": {
"end_date": {
"day": 17,
"year": 2024,
"month": 7
},
"start_date": {
"day": 17,
"year": 2024,
"month": 7
}
},
"dimensions": [
"DATE",
"APP",
"PLATFORM"
]
}
}
How can I dynamically pass the current date's year, month, and day to this request?kapa.ai
07/17/2024, 8:44 AMDR
07/17/2024, 8:46 AMkapa.ai
07/17/2024, 8:46 AMkapa.ai
07/17/2024, 8:46 AMDR
07/17/2024, 9:25 AM{{ now_utc().strftime('%d') }}
?kapa.ai
07/17/2024, 9:25 AMkapa.ai
07/17/2024, 9:25 AMnow_utc()
function in Jinja returns the current date and time in the UTC timezone. However, it does not directly support operations like subtracting a day. To retrieve the previous day's value, you would typically subtract one day from the current date. Unfortunately, the knowledge sources provided do not contain information on how to perform this operation using Jinja in the context of Airbyte. For more advanced date manipulations, you might need to use additional libraries or tools that can handle date arithmetic, or check if such functionality is available in the environment where your Jinja templates are being rendered. For more information on what's available in Jinja, you can refer to the [Jinja documentation](https://jinja.palletsprojects.com/en/3.0.x/templates/#expressions). For more information on how to use Jinja in Airbyte, you can refer to the [Airbyte documentation](https://docs.airbyte.com/connector-development/config-based/understanding-the-yaml-file/reference#macros).DR
07/17/2024, 9:27 AM{{ day_delta(-1) }}
gives yesterday's date, but is there a way to extract the day value from this date?kapa.ai
07/17/2024, 9:28 AMkapa.ai
07/17/2024, 9:29 AM{{ day_delta(-1) }}
by using the strftime()
function. Here is an example: jinja '{{ day_delta(-1).strftime('%d') }}'
This will return the day of the previous date. For example, if today's date is '2021-09-02', the above expression will return '01'. You can find more details about this in the [Airbyte documentation](https://docs.airbyte.com/connector-development/config-based/understanding-the-yaml-file/reference#/macros/Day%20Delta).DR
07/17/2024, 9:35 AMkapa.ai
07/17/2024, 9:35 AMkapa.ai
07/17/2024, 9:35 AM%-d
format code instead of %d
in the strftime()
function. Here is an example: jinja '{{ day_delta(-1).strftime('%-d') }}'
This will return the day of the previous date without a leading zero. For example, if yesterday's date was '2021-09-01', the above expression will return '1'. Please note that the %-d
format code works on Unix-based systems. If you are using a Windows system, you might need to use '%#d'
instead. You can find more details about this in the [Python strftime() documentation](https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes) and the [Airbyte documentation](https://docs.airbyte.com/connector-development/config-based/understanding-the-yaml-file/reference#/macros/Day%20Delta).