I'm new to elementary and I'm trying to incorporat...
# community-support
f
I'm new to elementary and I'm trying to incorporate it into my existing dbt project. We have a setup where we use dbt-checkpoint in pre-commit hooks. We have a hook that validates that we have an unique test on each model, see thread for exact details. I keep struggling that all elementary models have no unique tests (which is fine), however I would like to exclude the elementary models from the hook but keep running into the issue that they are not excluded. Any run into a similar issue and know how to resolve it?
✅ 1
A simplistic version of my `.pre-commit-config.yaml`:
Copy code
repos:
- repo: <https://github.com/dbt-checkpoint/dbt-checkpoint>
  rev: v1.1.1
  hooks:
  - id: dbt-clean
    additional_dependencies : ['dbt-core==1.7.4', 'dbt-postgres==1.7.4']
  - id: dbt-deps
    additional_dependencies : ['dbt-core==1.7.4', 'dbt-postgres==1.7.4']
  - id: dbt-compile
    additional_dependencies : ['dbt-core==1.7.4', 'dbt-postgres==1.7.4']
  - id: dbt-run
    additional_dependencies : ['dbt-core==1.7.4', 'dbt-postgres==1.7.4']
    args: ["--model-postfix", "+", "--"]
  - id: dbt-docs-generate
    additional_dependencies : ['dbt-core==1.7.4', 'dbt-postgres==1.7.4']
  - id: check-model-has-tests-by-group
    args: ["--tests", "unique", "unique_combination_of_columns", "equal_rowcount", "mutually_exclusive_ranges", "--test-cnt", "1", "--"]
    exclude: dbt_packages/
Part of the error I receive:
Copy code
Check the model has a number of tests from a group of tests........................Failed
- hook id: check-model-has-tests-by-group
- exit code: 1

snapshot_run_results: has only 0 test(s) from ['unique', 'unique_combination_of_columns', 'equal_rowcount', 'mutually_exclusive_ranges'].
job_run_results: has only 0 test(s) from ['unique', 'unique_combination_of_columns', 'equal_rowcount', 'mutually_exclusive_ranges'].
w
I've worked around this before by just limiting pre-commit checks to the directories where you keep your models/sources/macros etc. using a pre-commit file filter:
Copy code
- repo: <https://github.com/dbt-checkpoint/dbt-checkpoint>
    rev: v1.1.1
    hooks:
      # model checks
      - id: check-model-columns-have-desc
        files: 'models/.*$'
🎉 1
f
Thanks, will try it out straight away
The use of below code solved my issue:
Copy code
files: 'models/.*$'