dbt - Advanced TestingWhich of the following is the correct syntax to define a custom test in dbt?Atests: unique_test: test: unique column_name: idBtests: - unique_test: column_name: idCtests: - name: unique_test test: unique column_name: idDtests: - name: unique_test test: unique column_name: id severity: errorCheck Answer
Step-by-Step SolutionSolution:Step 1: Review dbt test YAML syntaxCustom tests in dbt are defined with a name, test type, column, and optional severity in a list format.Step 2: Identify correct structuretests: - name: unique_test test: unique column_name: id severity: error correctly uses a list item with name, test, column_name, and severity keys.Final Answer:tests:\n - name: unique_test\n test: unique\n column_name: id\n severity: error -> Option DQuick Check:Correct YAML list with keys = tests: - name: unique_test test: unique column_name: id severity: error [OK]Quick Trick: Custom tests need name, test, column, and optional severity [OK]Common Mistakes:MISTAKESUsing incorrect YAML indentationMissing the 'name' key for the testNot using a list for multiple tests
Master "Advanced Testing" in dbt9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More dbt Quizzes Advanced Testing - Unit testing dbt models - Quiz 3easy Advanced Testing - dbt-expectations for data quality - Quiz 4medium Advanced Testing - Store test failures for analysis - Quiz 14medium Jinja in dbt - For loops for dynamic SQL - Quiz 14medium Jinja in dbt - Calling macros across projects - Quiz 8hard Jinja in dbt - Variables and control flow - Quiz 12easy Jinja in dbt - Built-in Jinja context variables - Quiz 9hard Jinja in dbt - For loops for dynamic SQL - Quiz 11easy Project Organization - Staging, intermediate, and marts pattern - Quiz 4medium Project Organization - Why project structure scales with team size - Quiz 2easy