How to give empty string as accepted_values in DBT

getDbt

Jinja filter : as_text

If we are giving ‘ ‘ [ two single quotes ] , this will consider as Python keyword “None” and not as empty string. The as_text Jinja filter will convert output produced by the Jinja compiler back to text. It can be applied to yaml rendering situations when values must be supplied as strings rather than the datatype they appear to be.

Example

models:
  - name: freshers_table
    columns:
      - name: freshers_blog
        tests:
          - accepted_values:
              values: ['posted', 'draft', "{{ '' | as_text }}"]

NOTE : Native rendering is disabled by default in dbt version 0.17. The as_text filter therefore has no functional impact. This is not required in the later versions of dbt.

Author: user

Leave a Reply