13 lines
784 B
SQL
13 lines
784 B
SQL
{# A list of strings as an SQL list: ('a', 'b'). For rules from dbt vars, which are compiled in. #}
|
|
{% macro sql_list(valores) -%}
|
|
({% for v in valores %}'{{ v | replace("'", "''") }}'{% if not loop.last %}, {% endif %}{% endfor %})
|
|
{%- endmacro %}
|
|
|
|
{# A text column without accents and in upper case, to compare by containment with rules written that way. The
|
|
accents go first: SQLite's `upper` only knows ASCII. #}
|
|
{% macro sin_acentos_mayusculas(columna) -%}
|
|
{%- set pares = [('Á','A'),('É','E'),('Í','I'),('Ó','O'),('Ú','U'),('Ü','U'),
|
|
('á','a'),('é','e'),('í','i'),('ó','o'),('ú','u'),('ü','u')] -%}
|
|
upper({% for _ in pares %}replace({% endfor %}{{ columna }}{% for con, sin in pares %}, '{{ con }}', '{{ sin }}'){% endfor %})
|
|
{%- endmacro %}
|