Files
ISSSTELEON/Transformation/macros/date_literal.sql
T

18 lines
583 B
SQL

{#
A date written in the SQL, from a 'YYYY-MM-DD' value (a variable such as `fecha_corte`).
Elsewhere it's `cast('…' as date)`. SQLite has no date type: that cast yields the number 2025, so on SQLite
the date stays an ISO string, which is what its date functions (`julianday`) read.
#}
{% macro date_literal(value) -%}
{{ return(adapter.dispatch('date_literal', 'isssteleon')(value)) }}
{%- endmacro %}
{% macro default__date_literal(value) -%}
cast('{{ value }}' as date)
{%- endmacro %}
{% macro sqlite__date_literal(value) -%}
'{{ value }}'
{%- endmacro %}