sql_header in data tests
| Loading table... |
Set the require_sql_header_in_test_configs flag to true to enable support for the sql_header config for generic data tests. When enabled, you can set sql_header in the config of a generic data test at the model or column level in your properties.yml file. You can use sql_header to define SQL that should run before the test executes (for example, to create temporary functions, to set session parameters, or to declare variables required by the test query). dbt runs this SQL before executing the test.
For example:
models/properties.yml
models:
- name: orders
columns:
- name: order_id
data_tests:
- not_null:
name: not_null_orders_order_id
config:
sql_header: "-- SQL_HEADER_TEST_MARKER"
For more information, refer to Data test configurations.
Was this page helpful?
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
0