as_text
The as_text
Jinja filter will coerce Jinja-compiled output back to text. It
can be used in yaml rendering contexts where values must be provided as
strings, rather than as the datatype that they look like.
Heads up
Usage
In the example below, the as_text
filter is used to assert that ''
is an
empty string. In a native rendering, ''
would be coerced to the Python
keyword None
. This specification is necessary in v0.17.0
, but it is not
useful or necessary in later versions of dbt.
schema.yml
models:
- name: orders
columns:
- name: order_status
tests:
- accepted_values:
values: ['pending', 'shipped', "{{ '' | as_text }}"]
As of v0.17.1
, native rendering does not occur by default, and the as_text
specification is superfluous.
schema.yml
models:
- name: orders
columns:
- name: order_status
tests:
- accepted_values:
values: ['pending', 'shipped', '']
▶Changelog
0