28 lines
855 B
SQL
28 lines
855 B
SQL
{#
|
|
Casts for a model's output columns, so every engine returns the same types. dbt's type names work in
|
|
CAST on SQLite, SQL Server and PostgreSQL; MySQL only casts to CHAR and SIGNED.
|
|
#}
|
|
{% macro as_text(expression) -%}
|
|
{{ return(adapter.dispatch('as_text', 'isssteleon')(expression)) }}
|
|
{%- endmacro %}
|
|
|
|
{% macro default__as_text(expression) -%}
|
|
cast({{ expression }} as {{ dbt.type_string() }})
|
|
{%- endmacro %}
|
|
|
|
{% macro mysql__as_text(expression) -%}
|
|
cast({{ expression }} as char)
|
|
{%- endmacro %}
|
|
|
|
{% macro as_integer(expression) -%}
|
|
{{ return(adapter.dispatch('as_integer', 'isssteleon')(expression)) }}
|
|
{%- endmacro %}
|
|
|
|
{% macro default__as_integer(expression) -%}
|
|
cast({{ expression }} as {{ dbt.type_int() }})
|
|
{%- endmacro %}
|
|
|
|
{% macro mysql__as_integer(expression) -%}
|
|
cast({{ expression }} as signed)
|
|
{%- endmacro %}
|