Skip to main content

Platform-specific data types

Unit tests are designed to test for the expected values, not for the data types themselves. dbt takes the value you provide and attempts to cast it to the data type as inferred from the input and output models.

How you specify input and expected values in your unit test YAML definitions are largely consistent across data warehouses, with some variation for more complex data types. The following are platform-specific data types:


unit_tests:
- name: test_my_data_types
model: fct_data_types
given:
- input: ref('stg_data_types')
rows:
- int_field: 1
float_field: 2.0
str_field: my_string
str_escaped_field: "my,cool'string"
date_field: 2020-01-02
timestamp_field: 2013-11-03 00:00:00-0
timestamptz_field: 2013-11-03 00:00:00-0
number_field: 3
variant_field: 3
geometry_field: POINT(1820.12 890.56)
geography_field: POINT(-122.35 37.55)
object_field: {'Alberta':'Edmonton','Manitoba':'Winnipeg'}
str_array_field: ['a','b','c']
int_array_field: [1, 2, 3]

0