{"id":18992878,"url":"https://github.com/elementary-data/awesome-dbt-tests","last_synced_at":"2026-02-28T00:03:09.840Z","repository":{"id":223471364,"uuid":"760389502","full_name":"elementary-data/awesome-dbt-tests","owner":"elementary-data","description":null,"archived":false,"fork":false,"pushed_at":"2024-03-27T10:10:56.000Z","size":78,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-14T10:02:00.069Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elementary-data.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"contributing.md","funding":null,"license":"license.md","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}},"created_at":"2024-02-20T10:28:56.000Z","updated_at":"2025-02-10T13:31:19.000Z","dependencies_parsed_at":"2024-02-28T10:46:10.948Z","dependency_job_id":"11e3556c-94d4-40b4-9db9-6fd66e9f5439","html_url":"https://github.com/elementary-data/awesome-dbt-tests","commit_stats":null,"previous_names":["elementary-data/awesome-dbt-tests"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elementary-data%2Fawesome-dbt-tests","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elementary-data%2Fawesome-dbt-tests/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elementary-data%2Fawesome-dbt-tests/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elementary-data%2Fawesome-dbt-tests/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elementary-data","download_url":"https://codeload.github.com/elementary-data/awesome-dbt-tests/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239850421,"owners_count":19707349,"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":[],"created_at":"2024-11-08T17:19:09.731Z","updated_at":"2026-02-28T00:03:09.811Z","avatar_url":"https://github.com/elementary-data.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# dbt Tests index\n\nThis repo is dedicated to gathering, documenting, and sharing a comprehensive collection of dbt (data build tool) tests from various packages.\nOur goal is to provide a resource for data professionals looking to ensure data quality, integrity, and reliability within their dbt projects through effective testing.\n\n## 🎯 Repository Objective\n\nThis repository aims to create a community-driven collection of dbt tests, covering a wide range of use cases and data scenarios. By compiling tests from various dbt packages and encouraging the addition of real-world examples, we strive to foster a rich resource that enhances data testing practices within the dbt ecosystem.\n\n## 📦 Included tests sources\n\n- **dbt-core** native tests.\n\ndbt packages:\n- **[dbt-data-reliability](https://github.com/elementary-data/dbt-data-reliability):** Package by [Elementary](https://www.elementary-data.com/), the dbt native data observability platform.\n- **[dbt-expectations](https://github.com/calogica/dbt-expectations):** Inspired by the Great Expectations python library, providing a set of tests for data validation.\n- **[dbt-utils](https://github.com/dbt-labs/dbt-utils)**\n\nWe welcome contributions covering tests from any dbt package not listed above.\n\n## 🔎 dbt Tests categories\n\n[Data completeness](#data-completeness) - Tests to validate a dataset has all the expected records and data isn't missing. \n\n## 🔎 dbt Tests Index\n\n### Data completeness\n\n\u003cdetails\u003e\n\u003csummary\u003e\n    \u003cb\u003eexpect_row_values_to_have_data_for_every_n_datepart\u003c/b\u003e\n\u003c/summary\u003e\n\nThe test ensures data completeness by verifying the presence of data for every specified interval unit in your date or timestamp column.\nEssentially, it ensures that your dataset has data for every specified interval, such as every month, day, hour, etc., depending on your configuration.\n\nExample use cases:\n\n- **Financial reporting**: You're generating financial reports based on transaction data. By using this test with an interval of 1 for the month, you can ensure that your dataset has entries for every month, ensuring completeness in your financial reporting.\n- **Web traffic analysis**: You need to analyze website traffic on an hourly basis. Using this test with an interval of 1 for the hour, you can ensure that your dataset has entries for every hour, allowing you to accurately analyze traffic patterns throughout the day.\n\n**Test configuration**\n\nExpects model to have values for every grouped `date_part`.\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([source](https://github.com/calogica/dbt-expectations/blob/main/README.md#expect_row_values_to_have_data_for_every_n_datepart))\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\n    \u003cb\u003eat_least_one\u003c/b\u003e\n\u003c/summary\u003e\n\nAsserts that the tested column has at least one value.\nThe test will probably be useful with grouping by another column. \n\nExample use cases:\n- **Product events** - Some product events include the user email address, others don't. However, there must be an email for at least one event per user. \nThe test `at_least_one` can be configured on `user_email` column with `group_by_columns: user_name` configuration. \n\n**Test configuration**\n\nThis test supports the `group_by_columns` parameter.\n\n*Applies to:* Column\n\n```yaml\n models:\n  - name: model_name\n    columns:\n      - name: col_name\n        tests:\n          - dbt_utils.at_least_one:\n              group_by_columns: ['customer_segment']\n```\n\n([source](https://github.com/dbt-labs/dbt-utils/blob/main/README.md#at_least_one))\n\n\u003c/details\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felementary-data%2Fawesome-dbt-tests","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felementary-data%2Fawesome-dbt-tests","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felementary-data%2Fawesome-dbt-tests/lists"}