Expand description
Tera template engine setup and custom functions
This module configures the Tera template engine for rendering SQL templates. It provides:
- Template loading from the working directory
- Custom Tera functions (e.g.,
date_range)
ยงCustom Functions
ยงdate_range
Generates a list of dates between start and end dates (exclusive of end).
{% set start_date = "2022-01-01" %}
{% set end_date = "2022-01-05" %}
{% for date in date_range(start=start_date, end=end_date) %}
PARTITION (date='{{ date }}')
{% endfor %}This generates:
PARTITION (date='2022-01-01')
PARTITION (date='2022-01-02')
PARTITION (date='2022-01-03')
PARTITION (date='2022-01-04')Constantsยง
- DATE_
FORMAT ๐ - SQL_
FILE_ ๐EXTENSION
Functionsยง
- date_
range - get_
native_ ๐date - get_
tera - Get Tera template, load the template from working dir