{"id":13702966,"url":"https://github.com/calogica/dbt-expectations","last_synced_at":"2025-05-14T04:07:31.418Z","repository":{"id":37539932,"uuid":"306479180","full_name":"calogica/dbt-expectations","owner":"calogica","description":"Port(ish) of Great Expectations to dbt test macros","archived":false,"fork":false,"pushed_at":"2024-12-16T16:31:42.000Z","size":4286,"stargazers_count":1159,"open_issues_count":37,"forks_count":152,"subscribers_count":17,"default_branch":"main","last_synced_at":"2025-04-10T22:35:03.585Z","etag":null,"topics":["dbt"],"latest_commit_sha":null,"homepage":"https://calogica.github.io/dbt-expectations/","language":"Shell","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/calogica.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["calogica"]}},"created_at":"2020-10-22T23:12:37.000Z","updated_at":"2025-04-10T02:21:26.000Z","dependencies_parsed_at":"2023-02-01T09:30:37.722Z","dependency_job_id":"75984d25-a82d-462d-8552-9aabdd3c9907","html_url":"https://github.com/calogica/dbt-expectations","commit_stats":{"total_commits":289,"total_committers":42,"mean_commits":6.880952380952381,"dds":"0.15916955017301038","last_synced_commit":"c7dc2af8e1bd00b24583bea88cd883b88b706aab"},"previous_names":[],"tags_count":54,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calogica%2Fdbt-expectations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calogica%2Fdbt-expectations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calogica%2Fdbt-expectations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calogica%2Fdbt-expectations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/calogica","download_url":"https://codeload.github.com/calogica/dbt-expectations/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254069135,"owners_count":22009494,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dbt"],"created_at":"2024-08-02T21:00:47.402Z","updated_at":"2025-05-14T04:07:31.378Z","avatar_url":"https://github.com/calogica.png","language":"Shell","funding_links":["https://github.com/sponsors/calogica"],"categories":["📦 Included tests sources","Shell","Data Quality","others"],"sub_categories":[],"readme":"## Note: This package is no longer actively supported. \n\u003chr/\u003e\n\u003ch1 align=\"center\"\u003edbt-expectations\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n\u003cimg alt=\"logo\" width=\"10%\" src=\"https://raw.githubusercontent.com/calogica/dbt-expectations/main/static/dbt-expectations-logo.svg\" /\u003e\n\u003c/p\u003e\n\n\u003chr/\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://circleci.com/gh/calogica/dbt-expectations/tree/main\"\u003e\n\u003cimg alt=\"CircleCI\" src=\"https://img.shields.io/circleci/build/github/calogica/dbt-expectations/main?style=plastic\"/\u003e\n\u003c/a\u003e\n\u003cimg alt=\"License\" src=\"https://img.shields.io/badge/license-Apache--2.0-ff69b4?style=plastic\"/\u003e\n\n\u003c/p\u003e\n\n## About\n\n`dbt-expectations` is an extension package for [**dbt**](https://github.com/dbt-labs/dbt), inspired by the [Great Expectations package for Python](https://greatexpectations.io/). The intent is to allow dbt users to deploy GE-like tests in their data warehouse directly from dbt, vs having to add another integration with their data warehouse.\n\n## Install\n\n`dbt-expectations` currently supports `dbt 1.7.x` or higher.\n\nCheck [dbt package hub](https://hub.getdbt.com/calogica/dbt_expectations/latest/) for the latest installation instructions, or [read the docs](https://docs.getdbt.com/docs/package-management) for more information on installing packages.\n\nInclude in `packages.yml`\n\n```yaml\npackages:\n  - package: calogica/dbt_expectations\n    version: [\"\u003e=0.10.0\", \"\u003c0.11.0\"]\n    # \u003csee https://github.com/calogica/dbt-expectations/releases/latest\u003e for the latest version tag\n```\n\nThis package supports:\n\n* Postgres\n* Snowflake\n* BigQuery\n* DuckDB\n* Spark (experimental)\n* Trino\n\nFor latest release, see [https://github.com/calogica/dbt-expectations/releases](https://github.com/calogica/dbt-expectations/releases)\n\n### Dependencies\n\nThis package includes a reference to [`dbt-date`](https://github.com/calogica/dbt-date), so there's no need to also import `dbt-date` in your local project.\n\n### Variables\n\nThe following variables need to be defined in your `dbt_project.yml` file:\n\n```yaml\nvars:\n  'dbt_date:time_zone': 'America/Los_Angeles'\n```\n\nYou may specify [any valid timezone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) in place of `America/Los_Angeles`.\nFor example, use `America/New_York` for East Coast Time.\n\n## Available Tests\n\n### Table shape\n\n- [expect_column_to_exist](#expect_column_to_exist)\n- [expect_row_values_to_have_recent_data](#expect_row_values_to_have_recent_data)\n- [expect_grouped_row_values_to_have_recent_data](#expect_grouped_row_values_to_have_recent_data)\n- [expect_table_aggregation_to_equal_other_table](#expect_table_aggregation_to_equal_other_table)\n- [expect_table_column_count_to_be_between](#expect_table_column_count_to_be_between)\n- [expect_table_column_count_to_equal_other_table](#expect_table_column_count_to_equal_other_table)\n- [expect_table_column_count_to_equal](#expect_table_column_count_to_equal)\n- [expect_table_columns_to_not_contain_set](#expect_table_columns_to_not_contain_set)\n- [expect_table_columns_to_contain_set](#expect_table_columns_to_contain_set)\n- [expect_table_columns_to_match_ordered_list](#expect_table_columns_to_match_ordered_list)\n- [expect_table_columns_to_match_set](#expect_table_columns_to_match_set)\n- [expect_table_row_count_to_be_between](#expect_table_row_count_to_be_between)\n- [expect_table_row_count_to_equal_other_table](#expect_table_row_count_to_equal_other_table)\n- [expect_table_row_count_to_equal_other_table_times_factor](#expect_table_row_count_to_equal_other_table_times_factor)\n- [expect_table_row_count_to_equal](#expect_table_row_count_to_equal)\n\n### Missing values, unique values, and types\n\n- [expect_column_values_to_be_null](#expect_column_values_to_be_null)\n- [expect_column_values_to_not_be_null](#expect_column_values_to_not_be_null)\n- [expect_column_values_to_be_unique](#expect_column_values_to_be_unique)\n- [expect_column_values_to_be_of_type](#expect_column_values_to_be_of_type)\n- [expect_column_values_to_be_in_type_list](#expect_column_values_to_be_in_type_list)\n- [expect_column_values_to_have_consistent_casing](#expect_column_values_to_have_consistent_casing)\n\n### Sets and ranges\n\n- [expect_column_values_to_be_in_set](#expect_column_values_to_be_in_set)\n- [expect_column_values_to_not_be_in_set](#expect_column_values_to_not_be_in_set)\n- [expect_column_values_to_be_between](#expect_column_values_to_be_between)\n- [expect_column_values_to_be_decreasing](#expect_column_values_to_be_decreasing)\n- [expect_column_values_to_be_increasing](#expect_column_values_to_be_increasing)\n\n### String matching\n\n- [expect_column_value_lengths_to_be_between](#expect_column_value_lengths_to_be_between)\n- [expect_column_value_lengths_to_equal](#expect_column_value_lengths_to_equal)\n- [expect_column_values_to_match_like_pattern](#expect_column_values_to_match_like_pattern)\n- [expect_column_values_to_match_like_pattern_list](#expect_column_values_to_match_like_pattern_list)\n- [expect_column_values_to_match_regex](#expect_column_values_to_match_regex)\n- [expect_column_values_to_match_regex_list](#expect_column_values_to_match_regex_list)\n- [expect_column_values_to_not_match_like_pattern](#expect_column_values_to_not_match_like_pattern)\n- [expect_column_values_to_not_match_like_pattern_list](#expect_column_values_to_not_match_like_pattern_list)\n- [expect_column_values_to_not_match_regex](#expect_column_values_to_not_match_regex)\n- [expect_column_values_to_not_match_regex_list](#expect_column_values_to_not_match_regex_list)\n\n### Aggregate functions\n\n- [expect_column_distinct_count_to_be_greater_than](#expect_column_distinct_count_to_be_greater_than)\n- [expect_column_distinct_count_to_be_less_than](#expect_column_distinct_count_to_be_less_than)\n- [expect_column_distinct_count_to_equal_other_table](#expect_column_distinct_count_to_equal_other_table)\n- [expect_column_distinct_count_to_equal](#expect_column_distinct_count_to_equal)\n- [expect_column_distinct_values_to_be_in_set](#expect_column_distinct_values_to_be_in_set)\n- [expect_column_distinct_values_to_contain_set](#expect_column_distinct_values_to_contain_set)\n- [expect_column_distinct_values_to_equal_set](#expect_column_distinct_values_to_equal_set)\n- [expect_column_max_to_be_between](#expect_column_max_to_be_between)\n- [expect_column_mean_to_be_between](#expect_column_mean_to_be_between)\n- [expect_column_median_to_be_between](#expect_column_median_to_be_between)\n- [expect_column_min_to_be_between](#expect_column_min_to_be_between)\n- [expect_column_most_common_value_to_be_in_set](#expect_column_most_common_value_to_be_in_set)\n- [expect_column_proportion_of_unique_values_to_be_between](#expect_column_proportion_of_unique_values_to_be_between)\n- [expect_column_quantile_values_to_be_between](#expect_column_quantile_values_to_be_between)\n- [expect_column_stdev_to_be_between](#expect_column_stdev_to_be_between)\n- [expect_column_sum_to_be_between](#expect_column_sum_to_be_between)\n- [expect_column_unique_value_count_to_be_between](#expect_column_unique_value_count_to_be_between)\n\n### Multi-column\n\n- [expect_column_pair_values_A_to_be_greater_than_B](#expect_column_pair_values_a_to_be_greater_than_b)\n- [expect_column_pair_values_to_be_equal](#expect_column_pair_values_to_be_equal)\n- [expect_column_pair_values_to_be_in_set](#expect_column_pair_values_to_be_in_set)\n- [expect_compound_columns_to_be_unique](#expect_compound_columns_to_be_unique)\n- [expect_multicolumn_sum_to_equal](#expect_multicolumn_sum_to_equal)\n- [expect_select_column_values_to_be_unique_within_record](#expect_select_column_values_to_be_unique_within_record)\n\n### Distributional functions\n\n- [expect_column_values_to_be_within_n_moving_stdevs](#expect_column_values_to_be_within_n_moving_stdevs)\n- [expect_column_values_to_be_within_n_stdevs](#expect_column_values_to_be_within_n_stdevs)\n- [expect_row_values_to_have_data_for_every_n_datepart](#expect_row_values_to_have_data_for_every_n_datepart)\n\n## Documentation\n\n### [expect_column_to_exist](macros/schema_tests/table_shape/expect_column_to_exist.sql)\n\nExpect the specified column to exist.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_to_exist\n```\n\n### [expect_row_values_to_have_recent_data](macros/schema_tests/table_shape/expect_row_values_to_have_recent_data.sql)\n\nExpect the model to have rows that are at least as recent as the defined interval prior to the current timestamp. Optionally gives the possibility to apply filters on the results.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_row_values_to_have_recent_data:\n      datepart: day\n      interval: 1\n      row_condition: 'id is not null' #optional\n```\n\n### [expect_grouped_row_values_to_have_recent_data](macros/schema_tests/table_shape/expect_grouped_row_values_to_have_recent_data.sql)\n\nExpect the model to have **grouped** rows that are at least as recent as the defined interval prior to the current timestamp.\nUse this to test whether there is recent data for each grouped row defined by `group_by` (which is a list of columns) and a `timestamp_column`. Optionally gives the possibility to apply filters on the results.\n\n*Applies to:* Model, Seed, Source\n\n```yaml\nmodels: # or seeds:\n  - name : my_model\n    tests :\n      - dbt_expectations.expect_grouped_row_values_to_have_recent_data:\n          group_by: [group_id]\n          timestamp_column: date_day\n          datepart: day\n          interval: 1\n          row_condition: \"id is not null\" #optional\n      # or also:\n      - dbt_expectations.expect_grouped_row_values_to_have_recent_data:\n          group_by: [group_id, other_group_id]\n          timestamp_column: date_day\n          datepart: day\n          interval: 1\n          row_condition: \"id is not null\" #optional\n```\n\n### [expect_table_aggregation_to_equal_other_table](macros/schema_tests/table_shape/expect_table_aggregation_to_equal_other_table.sql)\n\nExpect an (optionally grouped) expression to match the same (or optionally other) expression in a different table.\n\n*Applies to:* Model, Seed, Source\n\nSimple:\n\n```yaml\ntests:\n  - dbt_expectations.expect_table_aggregation_to_equal_other_table:\n      expression: sum(col_numeric_a)\n      compare_model: ref(\"other_model\")\n      group_by: [idx]\n```\n\nMore complex:\n\n```yaml\ntests:\n  - dbt_expectations.expect_table_aggregation_to_equal_other_table:\n      expression: count(*)\n      compare_model: ref(\"other_model\")\n      compare_expression: count(distinct id)\n      group_by: [date_column]\n      compare_group_by: [some_other_date_column]\n```\n\nor:\n\n```yaml\ntests:\n  - dbt_expectations.expect_table_aggregation_to_equal_other_table:\n      expression: max(column_a)\n      compare_model: ref(\"other_model\")\n      compare_expression: max(column_b)\n      group_by: [date_column]\n      compare_group_by: [some_other_date_column]\n      row_condition: some_flag=true\n      compare_row_condition: some_flag=false\n```\n\n**Note**: You can also express a **tolerance** factor, either as an absolute tolerable difference, `tolerance`, or as a tolerable % difference `tolerance_percent` expressed as a decimal (i.e 0.05 for 5%).\n\n### [expect_table_column_count_to_be_between](macros/schema_tests/table_shape/expect_table_column_count_to_be_between.sql)\n\nExpect the number of columns in a model to be between two values.\n\n*Applies to:* Model, Seed, Source\n\n```yaml\ntests:\n  - dbt_expectations.expect_table_column_count_to_be_between:\n      min_value: 1 # (Optional)\n      max_value: 4 # (Optional)\n```\n\n### [expect_table_column_count_to_equal_other_table](macros/schema_tests/table_shape/expect_table_column_count_to_equal_other_table.sql)\n\nExpect the number of columns in a model to match another model.\n\n*Applies to:* Model, Seed, Source\n\n```yaml\nmodels: # or seeds:\n  - name: my_model\n    tests:\n      - dbt_expectations.expect_table_column_count_to_equal_other_table:\n          compare_model: ref(\"other_model\")\n```\n\n### [expect_table_columns_to_not_contain_set](macros/schema_tests/table_shape/expect_table_columns_to_not_contain_set.sql)\n\nExpect the columns in a model not to contain a given list.\n\n*Applies to:* Model, Seed, Source\n\n```yaml\nmodels: # or seeds:\n  - name: my_model\n    tests:\n      - dbt_expectations.expect_table_columns_to_not_contain_set:\n          column_list: [\"col_a\", \"col_b\"]\n          transform: upper # (Optional)\n```\n\n### [expect_table_columns_to_contain_set](macros/schema_tests/table_shape/expect_table_columns_to_contain_set.sql)\n\nExpect the columns in a model to contain a given list.\n\n*Applies to:* Model, Seed, Source\n\n```yaml\nmodels: # or seeds:\n  - name: my_model\n    tests:\n      - dbt_expectations.expect_table_columns_to_contain_set:\n          column_list: [\"col_a\", \"col_b\"]\n          transform: upper # (Optional)\n```\n\n### [expect_table_column_count_to_equal](macros/schema_tests/table_shape/expect_table_column_count_to_equal.sql)\n\nExpect the number of columns in a model to be equal to `expected_number_of_columns`.\n\n*Applies to:* Model, Seed, Source\n\n```yaml\nmodels: # or seeds:\n  - name: my_model\n    tests:\n      - dbt_expectations.expect_table_column_count_to_equal:\n          value: 7\n```\n\n### [expect_table_columns_to_match_ordered_list](macros/schema_tests/table_shape/expect_table_columns_to_match_ordered_list.sql)\n\nExpect the columns to exactly match a specified list.\n\n*Applies to:* Model, Seed, Source\n\n```yaml\nmodels: # or seeds:\n  - name: my_model\n    tests:\n      - dbt_expectations.expect_table_columns_to_match_ordered_list:\n          column_list: [\"col_a\", \"col_b\"]\n          transform: upper # (Optional)\n```\n\n### [expect_table_columns_to_match_set](macros/schema_tests/table_shape/expect_table_columns_to_match_set.sql)\n\nExpect the columns in a model to match a given list.\n\n*Applies to:* Model, Seed, Source\n\n```yaml\nmodels: # or seeds:\n  - name: my_model\n    tests:\n      - dbt_expectations.expect_table_columns_to_match_set:\n          column_list: [\"col_a\", \"col_b\"]\n          transform: upper # (Optional)\n```\n\n### [expect_table_row_count_to_be_between](macros/schema_tests/table_shape/expect_table_row_count_to_be_between.sql)\n\nExpect the number of rows in a model to be between two values.\n*Applies to:* Model, Seed, Source\n\n```yaml\nmodels: # or seeds:\n  - name: my_model\n    tests:\n      - dbt_expectations.expect_table_row_count_to_be_between:\n          min_value: 1 # (Optional)\n          max_value: 4 # (Optional)\n          group_by: [group_id, other_group_id, ...] # (Optional)\n          row_condition: \"id is not null\" # (Optional)\n          strictly: false # (Optional. Adds an 'or equal to' to the comparison operator for min/max)\n```\n\n### [expect_table_row_count_to_equal_other_table](macros/schema_tests/table_shape/expect_table_row_count_to_equal_other_table.sql)\n\nExpect the number of rows in a model match another model.\n\n*Applies to:* Model, Seed, Source\n\n```yaml\nmodels: # or seeds:\n  - name: my_model\n    tests:\n      - dbt_expectations.expect_table_row_count_to_equal_other_table:\n          compare_model: ref(\"other_model\")\n          group_by: [col1, col2] # (Optional)\n          compare_group_by: [col1, col2] # (Optional)\n          factor: 1 # (Optional)\n          row_condition: \"id is not null\" # (Optional)\n          compare_row_condition: \"id is not null\" # (Optional)\n```\n\n### [expect_table_row_count_to_equal_other_table_times_factor](macros/schema_tests/table_shape/expect_table_row_count_to_equal_other_table_times_factor.sql)\n\nExpect the number of rows in a model to match another model times a preconfigured factor.\n\n*Applies to:* Model, Seed, Source\n\n```yaml\nmodels: # or seeds:\n  - name: my_model\n    tests:\n      - dbt_expectations.expect_table_row_count_to_equal_other_table_times_factor:\n          compare_model: ref(\"other_model\")\n          factor: 13\n          group_by: [col1, col2] # (Optional)\n          compare_group_by: [col1, col2] # (Optional)\n          row_condition: \"id is not null\" # (Optional)\n          compare_row_condition: \"id is not null\" # (Optional)\n```\n\n### [expect_table_row_count_to_equal](macros/schema_tests/table_shape/expect_table_row_count_to_equal.sql)\n\nExpect the number of rows in a model to be equal to `expected_number_of_rows`.\n\n*Applies to:* Model, Seed, Source\n\n```yaml\nmodels: # or seeds:\n  - name: my_model\n    tests:\n      - dbt_expectations.expect_table_row_count_to_equal:\n          value: 4\n          group_by: [group_id, other_group_id, ...] # (Optional)\n          row_condition: \"id is not null\" # (Optional)\n```\n\n### [expect_column_values_to_be_unique](macros/schema_tests/column_values_basic/expect_column_values_to_be_unique.sql)\n\nExpect each column value to be unique.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_values_to_be_unique:\n      row_condition: \"id is not null\" # (Optional)\n```\n\n### [expect_column_values_to_not_be_null](macros/schema_tests/column_values_basic/expect_column_values_to_not_be_null.sql)\n\nExpect column values to not be null.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_values_to_not_be_null:\n      row_condition: \"id is not null\" # (Optional)\n```\n\n### [expect_column_values_to_be_null](macros/schema_tests/column_values_basic/expect_column_values_to_be_null.sql)\n\nExpect column values to be null.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_values_to_be_null:\n      row_condition: \"id is not null\" # (Optional)\n```\n\n### [expect_column_values_to_be_of_type](macros/schema_tests/column_values_basic/expect_column_values_to_be_of_type.sql)\n\nExpect a column to be of a specified data type.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_values_to_be_of_type:\n      column_type: date\n```\n\n### [expect_column_values_to_be_in_type_list](macros/schema_tests/column_values_basic/expect_column_values_to_be_in_type_list.sql)\n\nExpect a column to be one of a specified type list.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_values_to_be_in_type_list:\n      column_type_list: [date, datetime]\n```\n\n### [expect_column_values_to_have_consistent_casing](macros/schema_tests/column_values_basic/expect_column_values_to_have_consistent_casing.sql)\n\nExpect a column to have consistent casing. By setting `display_inconsistent_columns` to true, the number of inconsistent values in the column will be displayed in the terminal whereas the inconsistent values themselves will be returned if the SQL compiled test is run.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_values_to_have_consistent_casing:\n      display_inconsistent_columns: false # (Optional)\n```\n\n### [expect_column_values_to_be_in_set](macros/schema_tests/column_values_basic/expect_column_values_to_be_in_set.sql)\n\nExpect each column value to be in a given set.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_values_to_be_in_set:\n      value_set: ['a','b','c']\n      quote_values: true # (Optional. Default is 'true'.)\n      row_condition: \"id is not null\" # (Optional)\n```\n\n### [expect_column_values_to_be_between](macros/schema_tests/column_values_basic/expect_column_values_to_be_between.sql)\n\nExpect each column value to be between two values.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_values_to_be_between:\n      min_value: 0  # (Optional)\n      max_value: 10 # (Optional)\n      row_condition: \"id is not null\" # (Optional)\n      strictly: false # (Optional. Default is 'false'. Adds an 'or equal to' to the comparison operator for min/max)\n```\n\n### [expect_column_values_to_not_be_in_set](macros/schema_tests/column_values_basic/expect_column_values_to_not_be_in_set.sql)\n\nExpect each column value not to be in a given set.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_values_to_not_be_in_set:\n      value_set: ['e','f','g']\n      quote_values: true # (Optional. Default is 'true'.)\n      row_condition: \"id is not null\" # (Optional)\n```\n\n### [expect_column_values_to_be_increasing](macros/schema_tests/column_values_basic/expect_column_values_to_be_increasing.sql)\n\nExpect column values to be increasing.\n\nIf `strictly: True`, then this expectation is only satisfied if each consecutive value is strictly increasing – equal values are treated as failures.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_values_to_be_increasing:\n      sort_column: date_day\n      row_condition: \"id is not null\" # (Optional)\n      strictly: true # (Optional for comparison operator. Default is 'true', and it uses '\u003e'. If set to 'false' it uses '\u003e='.)\n      group_by: [group_id, other_group_id, ...] # (Optional)\n      step: 1 # (Optional. If set, it requires the difference between values to be exactly this step. Requires numeric columns.)\n```\n\n### [expect_column_values_to_be_decreasing](macros/schema_tests/column_values_basic/expect_column_values_to_be_decreasing.sql)\n\nExpect column values to be decreasing.\n\nIf `strictly=True`, then this expectation is only satisfied if each consecutive value is strictly decreasing – equal values are treated as failures.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_values_to_be_decreasing:\n      sort_column: col_numeric_a\n      row_condition: \"id is not null\" # (Optional)\n      strictly: true # (Optional for comparison operator. Default is 'true' and it uses '\u003c'. If set to 'false', it uses '\u003c='.)\n      group_by: [group_id, other_group_id, ...] # (Optional)\n      step: 1 # (Optional. If set, it requires the difference between values to be exactly this step. Requires numeric columns.)\n```\n\n### [expect_column_value_lengths_to_be_between](macros/schema_tests/string_matching/expect_column_value_lengths_to_be_between.sql)\n\nExpect column entries to be strings with length between a min_value value and a max_value value (inclusive).\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_value_lengths_to_be_between:\n      min_value: 1 # (Optional)\n      max_value: 4 # (Optional)\n      row_condition: \"id is not null\" # (Optional)\n      strictly: false # (Optional. Default is 'false'. Adds an 'or equal to' to the comparison operator for min/max)\n```\n\n### [expect_column_value_lengths_to_equal](macros/schema_tests/string_matching/expect_column_value_lengths_to_equal.sql)\n\nExpect column entries to be strings with length equal to the provided value.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_value_lengths_to_equal:\n      value: 10\n      row_condition: \"id is not null\" # (Optional)\n```\n\n### [expect_column_values_to_match_regex](macros/schema_tests/string_matching/expect_column_values_to_match_regex.sql)\n\nExpect column entries to be strings that match a given regular expression. Valid matches can be found anywhere in the string, for example \"[at]+\" will identify the following strings as expected: \"cat\", \"hat\", \"aa\", \"a\", and \"t\", and the following strings as unexpected: \"fish\", \"dog\".\n\nOptional (keyword) arguments:\n\n- `is_raw` indicates the `regex` pattern is a \"raw\" string and should be escaped. The default is `False`.\n- `flags` is a string of one or more characters that are passed to the regex engine as flags (or parameters). Allowed flags are adapter-specific. A common flag is `i`, for case-insensitive matching. The default is no flags.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_values_to_match_regex:\n      regex: \"[at]+\"\n      row_condition: \"id is not null\" # (Optional)\n      is_raw: True # (Optional)\n      flags: i # (Optional)\n```\n\n### [expect_column_values_to_not_match_regex](macros/schema_tests/string_matching/expect_column_values_to_not_match_regex.sql)\n\nExpect column entries to be strings that do NOT match a given regular expression. The regex must not match any portion of the provided string. For example, \"[at]+\" would identify the following strings as expected: \"fish”, \"dog”, and the following as unexpected: \"cat”, \"hat”.\n\nOptional (keyword) arguments:\n\n- `is_raw` indicates the `regex` pattern is a \"raw\" string and should be escaped. The default is `False`.\n- `flags` is a string of one or more characters that are passed to the regex engine as flags (or parameters). Allowed flags are adapter-specific. A common flag is `i`, for case-insensitive matching. The default is no flags.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_values_to_not_match_regex:\n      regex: \"[at]+\"\n      row_condition: \"id is not null\" # (Optional)\n      is_raw: True # (Optional)\n      flags: i # (Optional)\n```\n\n### [expect_column_values_to_match_regex_list](macros/schema_tests/string_matching/expect_column_values_to_match_regex_list.sql)\n\nExpect the column entries to be strings that can be matched to either any of or all of a list of regular expressions. Matches can be anywhere in the string.\n\nOptional (keyword) arguments:\n\n- `is_raw` indicates the `regex` pattern is a \"raw\" string and should be escaped. The default is `False`.\n- `flags` is a string of one or more characters that are passed to the regex engine as flags (or parameters). Allowed flags are adapter-specific. A common flag is `i`, for case-insensitive matching. The default is no flags.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_values_to_match_regex_list:\n      regex_list: [\"@[^.]*\", \"\u0026[^.]*\"]\n      match_on: any # (Optional. Default is 'any', which applies an 'OR' for each regex. If 'all', it applies an 'AND' for each regex.)\n      row_condition: \"id is not null\" # (Optional)\n      is_raw: True # (Optional)\n      flags: i # (Optional)\n```\n\n### [expect_column_values_to_not_match_regex_list](macros/schema_tests/string_matching/expect_column_values_to_not_match_regex_list.sql)\n\nExpect the column entries to be strings that do not match any of a list of regular expressions. Matches can be anywhere in the string.\n\nOptional (keyword) arguments:\n\n- `is_raw` indicates the `regex` pattern is a \"raw\" string and should be escaped. The default is `False`.\n- `flags` is a string of one or more characters that are passed to the regex engine as flags (or parameters). Allowed flags are adapter-specific. A common flag is `i`, for case-insensitive matching. The default is no flags.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_values_to_not_match_regex_list:\n      regex_list: [\"@[^.]*\", \"\u0026[^.]*\"]\n      match_on: any # (Optional. Default is 'any', which applies an 'OR' for each regex. If 'all', it applies an 'AND' for each regex.)\n      row_condition: \"id is not null\" # (Optional)\n      is_raw: True # (Optional)\n      flags: i # (Optional)\n```\n\n### [expect_column_values_to_match_like_pattern](macros/schema_tests/string_matching/expect_column_values_to_match_like_pattern.sql)\n\nExpect column entries to be strings that match a given SQL `like` pattern.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_values_to_match_like_pattern:\n      like_pattern: \"%@%\"\n      row_condition: \"id is not null\" # (Optional)\n```\n\n### [expect_column_values_to_not_match_like_pattern](macros/schema_tests/string_matching/expect_column_values_to_not_match_like_pattern.sql)\n\nExpect column entries to be strings that do not match a given SQL `like` pattern.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_values_to_not_match_like_pattern:\n      like_pattern: \"%\u0026%\"\n      row_condition: \"id is not null\" # (Optional)\n```\n\n### [expect_column_values_to_match_like_pattern_list](macros/schema_tests/string_matching/expect_column_values_to_match_like_pattern_list.sql)\n\nExpect the column entries to be strings that match any of a list of SQL `like` patterns.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_values_to_match_like_pattern_list:\n      like_pattern_list: [\"%@%\", \"%\u0026%\"]\n      match_on: any # (Optional. Default is 'any', which applies an 'OR' for each pattern. If 'all', it applies an 'AND' for each regex.)\n      row_condition: \"id is not null\" # (Optional)\n```\n\n### [expect_column_values_to_not_match_like_pattern_list](macros/schema_tests/string_matching/expect_column_values_to_not_match_like_pattern_list.sql)\n\nExpect the column entries to be strings that do not match any of a list of SQL `like` patterns.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_values_to_not_match_like_pattern_list:\n      like_pattern_list: [\"%@%\", \"%\u0026%\"]\n      match_on: any # (Optional. Default is 'any', which applies an 'OR' for each pattern. If 'all', it applies an 'AND' for each regex.)\n      row_condition: \"id is not null\" # (Optional)\n```\n\n### [expect_column_distinct_count_to_equal](macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_equal.sql)\n\nExpect the number of distinct column values to be equal to a given value.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_distinct_count_to_equal:\n      value: 10\n      quote_values: true # (Optional. Default is 'true'.)\n      group_by: [group_id, other_group_id, ...] # (Optional)\n      row_condition: \"id is not null\" # (Optional)\n```\n\n### [expect_column_distinct_count_to_be_greater_than](macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_be_greater_than.sql)\n\nExpect the number of distinct column values to be greater than a given value.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_distinct_count_to_be_greater_than:\n      value: 10\n      quote_values: true # (Optional. Default is 'true'.)\n      group_by: [group_id, other_group_id, ...] # (Optional)\n      row_condition: \"id is not null\" # (Optional)\n```\n\n### [expect_column_distinct_count_to_be_less_than](macros/schema_tests/aggregate_functions/expect_column_less_count_to_be_less_than.sql)\n\nExpect the number of distinct column values to be less than a given value.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_distinct_count_to_be_less_than:\n      value: 10\n      quote_values: true # (Optional. Default is 'true'.)\n      group_by: [group_id, other_group_id, ...] # (Optional)\n      row_condition: \"id is not null\" # (Optional)\n```\n\n### [expect_column_distinct_values_to_be_in_set](macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_be_in_set.sql)\n\nExpect the set of distinct column values to be contained by a given set.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_distinct_values_to_be_in_set:\n      value_set: ['a','b','c','d']\n      quote_values: true # (Optional. Default is 'true'.)\n      row_condition: \"id is not null\" # (Optional)\n```\n\n### [expect_column_distinct_values_to_contain_set](macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_contain_set.sql)\n\nExpect the set of distinct column values to contain a given set.\n\nIn contrast to `expect_column_values_to_be_in_set` this ensures not that all column values are members of the given set but that values from the set must be present in the column.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_distinct_values_to_contain_set:\n      value_set: ['a','b']\n      quote_values: true # (Optional. Default is 'true'.)\n      row_condition: \"id is not null\" # (Optional)\n```\n\n### [expect_column_distinct_values_to_equal_set](macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_equal_set.sql)\n\nExpect the set of distinct column values to equal a given set.\n\nIn contrast to `expect_column_distinct_values_to_contain_set` this ensures not only that a certain set of values are present in the column but that these and only these values are present.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_distinct_values_to_equal_set:\n      value_set: ['a','b','c']\n      quote_values: true # (Optional. Default is 'true'.)\n      row_condition: \"id is not null\" # (Optional)\n```\n\n### [expect_column_distinct_count_to_equal_other_table](macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_equal_other_table.sql)\n\nExpect the number of distinct column values to be equal to number of distinct values in another model.\n\n*Applies to:* Model, Column, Seed, Source\n\nThis can be applied to a model:\n\n```yaml\nmodels: # or seeds:\n  - name: my_model_1\n    tests:\n      - dbt_expectations.expect_column_distinct_count_to_equal_other_table:\n          column_name: col_1\n          compare_model: ref(\"my_model_2\")\n          compare_column_name: col_2\n          row_condition: \"id is not null\" # (Optional)\n          compare_row_condition: \"id is not null\" # (Optional)\n```\n\nor at the column level:\n\n```yaml\nmodels: # or seeds:\n  - name: my_model_1\n    columns:\n      - name: col_1\n        tests:\n          - dbt_expectations.expect_column_distinct_count_to_equal_other_table:\n              compare_model: ref(\"my_model_2\")\n              compare_column_name: col_2\n              row_condition: \"id is not null\" # (Optional)\n              compare_row_condition: \"id is not null\" # (Optional)\n```\n\nIf `compare_model` or `compare_column_name` are no specified, `model` and `column_name` are substituted. So, one could compare distinct counts of two different columns in the same model, or identically named columns in separate models etc.\n\n### [expect_column_mean_to_be_between](macros/schema_tests/aggregate_functions/expect_column_mean_to_be_between.sql)\n\nExpect the column mean to be between a min_value value and a max_value value (inclusive).\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_mean_to_be_between:\n      min_value: 0 # (Optional)\n      max_value: 2 # (Optional)\n      group_by: [group_id, other_group_id, ...] # (Optional)\n      row_condition: \"id is not null\" # (Optional)\n      strictly: false # (Optional. Default is 'false'. Adds an 'or equal to' to the comparison operator for min/max)\n```\n\n### [expect_column_median_to_be_between](macros/schema_tests/aggregate_functions/expect_column_median_to_be_between.sql)\n\nExpect the column median to be between a min_value value and a max_value value (inclusive).\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_median_to_be_between:\n      min_value: 0\n      max_value: 2\n      group_by: [group_id, other_group_id, ...] # (Optional)\n      row_condition: \"id is not null\" # (Optional)\n      strictly: false # (Optional. Default is 'false'. Adds an 'or equal to' to the comparison operator for min/max)\n```\n\n### [expect_column_quantile_values_to_be_between](macros/schema_tests/aggregate_functions/expect_column_quantile_values_to_be_between.sql)\n\nExpect specific provided column quantiles to be between provided min_value and max_value values.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_quantile_values_to_be_between:\n      quantile: .95\n      min_value: 0 # (Optional)\n      max_value: 2 # (Optional)\n      group_by: [group_id, other_group_id, ...] # (Optional)\n      row_condition: \"id is not null\" # (Optional)\n      strictly: false # (Optional. Default is 'false'. Adds an 'or equal to' to the comparison operator for min/max)\n```\n\n### [expect_column_stdev_to_be_between](macros/schema_tests/aggregate_functions/expect_column_stdev_to_be_between.sql)\n\nExpect the column standard deviation to be between a min_value value and a max_value value. Uses sample standard deviation (normalized by N-1).\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_stdev_to_be_between:\n      min_value: 0 # (Optional)\n      max_value: 2 # (Optional)\n      group_by: [group_id, other_group_id, ...] # (Optional)\n      row_condition: \"id is not null\" # (Optional)\n      strictly: false # (Optional. Default is 'false'. Adds an 'or equal to' to the comparison operator for min/max)\n```\n\n### [expect_column_unique_value_count_to_be_between](macros/schema_tests/aggregate_functions/expect_column_unique_value_count_to_be_between.sql)\n\nExpect the number of unique values to be between a min_value value and a max_value value.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_unique_value_count_to_be_between:\n      min_value: 3 # (Optional)\n      max_value: 3 # (Optional)\n      group_by: [group_id, other_group_id, ...] # (Optional)\n      row_condition: \"id is not null\" # (Optional)\n      strictly: false # (Optional. Default is 'false'. Adds an 'or equal to' to the comparison operator for min/max)\n```\n\n### [expect_column_proportion_of_unique_values_to_be_between](macros/schema_tests/aggregate_functions/expect_column_proportion_of_unique_values_to_be_between.sql)\n\nExpect the proportion of unique values to be between a min_value value and a max_value value.\n\nFor example, in a column containing [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], there are 4 unique values and 10 total values for a proportion of 0.4.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_proportion_of_unique_values_to_be_between:\n      min_value: 0  # (Optional)\n      max_value: .4 # (Optional)\n      group_by: [group_id, other_group_id, ...] # (Optional)\n      row_condition: \"id is not null\" # (Optional)\n      strictly: false # (Optional. Default is 'false'. Adds an 'or equal to' to the comparison operator for min/max)\n```\n\n### [expect_column_most_common_value_to_be_in_set](macros/schema_tests/aggregate_functions/expect_column_most_common_value_to_be_in_set.sql)\n\nExpect the most common value to be within the designated value set\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_most_common_value_to_be_in_set:\n      value_set: [0.5]\n      top_n: 1\n      quote_values: true # (Optional. Default is 'true'.)\n      data_type: \"decimal\" # (Optional. Default is 'decimal')\n      strictly: false # (Optional. Default is 'false'. Adds an 'or equal to' to the comparison operator for min/max)\n```\n\n### [expect_column_max_to_be_between](macros/schema_tests/aggregate_functions/expect_column_max_to_be_between.sql)\n\nExpect the column max to be between a min and max value\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_max_to_be_between:\n      min_value: 1 # (Optional)\n      max_value: 1 # (Optional)\n      group_by: [group_id, other_group_id, ...] # (Optional)\n      row_condition: \"id is not null\" # (Optional)\n      strictly: false # (Optional. Default is 'false'. Adds an 'or equal to' to the comparison operator for min/max)\n```\n\n### [expect_column_min_to_be_between](macros/schema_tests/aggregate_functions/expect_column_min_to_be_between.sql)\n\nExpect the column min to be between a min and max value\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_min_to_be_between:\n      min_value: 0 # (Optional)\n      max_value: 1 # (Optional)\n      group_by: [group_id, other_group_id, ...] # (Optional)\n      row_condition: \"id is not null\" # (Optional)\n      strictly: false # (Optional. Default is 'false'. Adds an 'or equal to' to the comparison operator for min/max)\n```\n\n### [expect_column_sum_to_be_between](macros/schema_tests/aggregate_functions/expect_column_sum_to_be_between.sql)\n\nExpect the column to sum to be between a min and max value\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_sum_to_be_between:\n      min_value: 1 # (Optional)\n      max_value: 2 # (Optional)\n      group_by: [group_id, other_group_id, ...] # (Optional)\n      row_condition: \"id is not null\" # (Optional)\n      strictly: false # (Optional. Default is 'false'. Adds an 'or equal to' to the comparison operator for min/max)\n```\n\n### [expect_column_pair_values_A_to_be_greater_than_B](macros/schema_tests/multi-column/expect_column_pair_values_A_to_be_greater_than_B.sql)\n\nExpect values in column A to be greater than column B.\n\n*Applies to:* Model, Seed, Source\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_pair_values_A_to_be_greater_than_B:\n      column_A: col_numeric_a\n      column_B: col_numeric_a\n      or_equal: True\n      row_condition: \"id is not null\" # (Optional)\n```\n\n### [expect_column_pair_values_to_be_equal](macros/schema_tests/multi-column/expect_column_pair_values_to_be_equal.sql)\n\nExpect the values in column A to be the same as column B.\n\n*Applies to:* Model, Seed, Source\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_pair_values_to_be_equal:\n      column_A: col_numeric_a\n      column_B: col_numeric_a\n      row_condition: \"id is not null\" # (Optional)\n```\n\n### [expect_column_pair_values_to_be_in_set](macros/schema_tests/multi-column/expect_column_pair_values_to_be_in_set.sql)\n\nExpect paired values from columns A and B to belong to a set of valid pairs.\n\nNote: value pairs are expressed as lists within lists\n\n*Applies to:* Model, Seed, Source\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_pair_values_to_be_in_set:\n      column_A: col_numeric_a\n      column_B: col_numeric_b\n      value_pairs_set: [[0, 1], [1, 0], [0.5, 0.5], [0.5, 0.5]]\n      row_condition: \"id is not null\" # (Optional)\n```\n\n### [expect_select_column_values_to_be_unique_within_record](macros/schema_tests/multi-column/expect_select_column_values_to_be_unique_within_record.sql)\n\nExpect the values for each record to be unique across the columns listed. Note that records can be duplicated.\n\n*Applies to:* Model, Seed, Source\n\n```yaml\ntests:\n  - dbt_expectations.expect_select_column_values_to_be_unique_within_record:\n      column_list: [\"col_string_a\", \"col_string_b\"]\n      ignore_row_if: \"any_value_is_missing\" # (Optional. Default is 'all_values_are_missing')\n      quote_columns: false # (Optional)\n      row_condition: \"id is not null\" # (Optional)\n```\n\nNote:\n\n- `all_values_are_missing` (default) means that rows are excluded where *all* of the test columns are `null`\n- `any_value_is_missing` means that rows are excluded where *either* of the test columns are `null`\n\n### [expect_multicolumn_sum_to_equal](macros/schema_tests/multi-column/expect_multicolumn_sum_to_equal.sql)\n\nExpects that sum of all rows for a set of columns is equal to a specific value\n\n*Applies to:* Model, Seed, Source\n\n```yaml\ntests:\n  - dbt_expectations.expect_multicolumn_sum_to_equal:\n      column_list: [\"col_numeric_a\", \"col_numeric_b\"]\n      sum_total: 4\n      group_by: [group_id, other_group_id, ...] # (Optional)\n      row_condition: \"id is not null\" # (Optional)\n```\n\n### [expect_compound_columns_to_be_unique](macros/schema_tests/multi-column/expect_compound_columns_to_be_unique.sql)\n\nExpect that the columns are unique together, e.g. a multi-column primary key.\n\n*Applies to:* Model, Seed, Source\n\n```yaml\ntests:\n  - dbt_expectations.expect_compound_columns_to_be_unique:\n      column_list: [\"date_col\", \"col_string_b\"]\n      ignore_row_if: \"any_value_is_missing\" # (Optional. Default is 'all_values_are_missing')\n      quote_columns: false # (Optional)\n      row_condition: \"id is not null\" # (Optional)\n```\n\nNote:\n\n- `all_values_are_missing` (default) means that rows are excluded where *all* of the test columns are `null`\n- `any_value_is_missing` means that rows are excluded where *either* of the test columns are `null`\n\n### [expect_column_values_to_be_within_n_moving_stdevs](macros/schema_tests/distributional/expect_column_values_to_be_within_n_moving_stdevs.sql)\n\nA simple anomaly test based on the assumption that differences between periods in a given time series follow a log-normal distribution.\nThus, we would expect the logged differences (vs N periods ago) in metric values to be within Z sigma away from a moving average.\nBy applying a list of columns in the `group_by` parameter, you can also test for deviations within a group.\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_values_to_be_within_n_moving_stdevs:\n      date_column_name: date\n      period: day # (Optional. Default is 'day')\n      lookback_periods: 1 # (Optional. Default is 1)\n      trend_periods: 7 # (Optional. Default is 7)\n      test_periods: 14 # (Optional. Default is 14)\n      sigma_threshold: 3 # (Optional. Default is 3)\n      take_logs: true # (Optional. Default is 'true')\n      sigma_threshold_upper: x # (Optional. Replace 'x' with a value. Default is 'None')\n      sigma_threshold_lower: y # (Optional. Replace 'y' with a value. Default is 'None')\n      take_diffs: true # (Optional. Default is 'true')\n      group_by: [group_id] # (Optional. Default is 'None')\n```\n\n### [expect_column_values_to_be_within_n_stdevs](macros/schema_tests/distributional/expect_column_values_to_be_within_n_stdevs.sql)\n\nExpects (optionally grouped \u0026 summed) metric values to be within Z sigma away from the column average\n\n*Applies to:* Column\n\n```yaml\ntests:\n  - dbt_expectations.expect_column_values_to_be_within_n_stdevs:\n      group_by: group_id # (Optional. Default is 'None')\n      sigma_threshold: 3 # (Optional. Default is 3)\n```\n\n### [expect_row_values_to_have_data_for_every_n_datepart](macros/schema_tests/distributional/expect_row_values_to_have_data_for_every_n_datepart.sql)\n\nExpects model to have values for every grouped `date_part`.\n\nFor example, this tests whether a model has data for every `day` (grouped on `date_col`) between either:\n\n- The `min`/`max` value of the specified `date_col` (default).\n- A specified `test_start_date` and/or `test_end_date`.\n\n*Applies to:* Model, Seed, Source\n\n```yaml\ntests:\n    - dbt_expectations.expect_row_values_to_have_data_for_every_n_datepart:\n        date_col: date_day\n        date_part: day # (Optional. Default is 'day')\n        row_condition: \"id is not null\" # (Optional)\n        test_start_date: 'yyyy-mm-dd' # (Optional. Replace 'yyyy-mm-dd' with a date. Default is 'None')\n        test_end_date: 'yyyy-mm-dd' # (Optional. Replace 'yyyy-mm-dd' with a date. Default is 'None')\n        exclusion_condition: statement # (Optional. See details below. Default is 'None')\n```\n\n**Notes**:\n\n- `test_end_date` is exclusive, e.g. a test with `test_end_date` value of `'2020-01-05'` will pass if your model has data through `'2021-01-04'`.\n\n- If `test_start_date` or `test_end_date` are not specified, the test automatically determines the `min`/`max` of the specified `date_col` from your data, respectively.\nOn some platforms, and/or if your table is not partitione on that date column, this may lead to performance issues. In these cases, we recommend setting an explicit date literal. You may also set a \"dynamic\" date literal via the built-in `modules.datetime` functions:\n\n```yaml\n    date_part: day\n    test_start_date: '2021-05-01'\n    test_end_date: '{{ modules.datetime.date.today() }}'\n```\n\nor, for example:\n\n```yaml\n    date_part: day\n    test_start_date: '2021-05-01'\n    test_end_date: '{{ modules.datetime.date.today() - modules.datetime.timedelta(1) }}'\n```\n\nUnfortunately, you currently **cannot** use a dynamic SQL date, such as `current_date` or macro from a dbt package such as dbt-date, as the underlying `date_spine` macro expects a date literal.\n\nThe `interval` argument will optionally group `date_part` by a given integer to test data presence at a lower granularity, e.g. adding `interval: 7` to the example above will test whether a model has data for each 7-`day` period instead of for each `day`.\n\nKnown or expected missing dates can be excluded from the test by setting the `exclusion_criteria` with a valid SQL statement; e.g., adding `exclusion_condition: not(date_day = '2021-10-19')` will ensure that test passes if and only if `date_day = '2021-10-19'` is the only date with missing data. Alternatively, `exclusion_condition: not(date_part(month, date_day) = 12 and date_part(day, date_day) = 25)` will permit data to be missing on the 25th of December (Christmas day) every year.\n\n## ~ Developers Only ~\n\n### Integration Tests\n\nThis project contains integration tests for all test macros in a separate `integration_tests` dbt project contained in this repo.\n\nTo run the tests:\n\n1. You will need a profile called `integration_tests` in `~/.dbt/profiles.yml` pointing to a writable database. We only support postgres, BigQuery and Snowflake.\n2. Then, from within the `integration_tests` folder, run `dbt build` to run the test models in `integration_tests/models/schema_tests/` and run the tests specified in `integration_tests/models/schema_tests/schema.yml`\n\n\u003cimg src=\"https://raw.githubusercontent.com/calogica/dbt-expectations/main/expectations.gif\"/\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalogica%2Fdbt-expectations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcalogica%2Fdbt-expectations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalogica%2Fdbt-expectations/lists"}