id, email, REGEXP_CONTAINS( email, r'^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$' ) AS is_valid_email_address, FROM {{ source('tmp_study_dbt_yamamoto', 'raw_users') }} stg_users.sql unit_tests: - name: test_is_valid_email_address model: stg_users given: - input: source('tmp_study_dbt_yamamoto', 'raw_users') rows: - {id: 1, email: '
[email protected]'} - {id: 2, email: 'fuga'} - {id: 3, email: NULL} expect: rows: - {id: 1, email: '
[email protected]', is_valid_email_address: TRUE} - {id: 2, email: 'fuga', is_valid_email_address: FALSE} - {id: 3, email: NULL, is_valid_email_address: NULL} _schema.yml 参考: dbt v1.8で追加された単体テストを触ってみた - Speaker Deck ⼊⼒値 期待する 出⼒値