dbt-project-evaluator
dbt-project-evaluator copied to clipboard
Issue with output of print_dbt_project_evaluator_issues
Describe the bug
Following these instructions, I used the macro print_dbt_project_evaluator_issues in the property on-run-end. At the end of running dbt_project_evaluator, I get nothing.
on-run-end: "{{ dbt_project_evaluator.print_dbt_project_evaluator_issues() }}"
Steps to reproduce
My dbt_project.yml looks something like this:
config-version: 2
model-paths: ["models"]
analysis-paths: ["analyses"]
test-paths: ["tests"]
seed-paths: ["seeds"]
macro-paths: ["macros"]
snapshot-paths: ["snapshots"]
vars:
exclude_paths_from_project: ["/stg_media_status_events.sql", "/stg_user_accounts.sql"]
models:
dbt_project_evaluator:
marts:
structure:
fct_model_naming_conventions:
+enabled: false
fct_source_directories:
+enabled: false
fct_model_directories:
+enabled: false
dag:
fct_staging_dependent_on_staging:
+enabled: false
fct_rejoining_of_upstream_concepts:
+enabled: false
on-run-end: "{{ dbt_project_evaluator.print_dbt_project_evaluator_issues() }}"
Run the command:
dbt build package:dbt_project_evaluator
Expected results
I expect dbt_project_evaluator to show up information about the warn steps highlighted in the command.
Screenshots and log output
01:03:48 Finished running 23 table models, 1 seed, 15 view models, 22 tests, 2 hooks in 0 hours 0 minutes and 33.90 seconds (33.90s).
01:03:48 Completed with 2 warnings:
01:03:48 Warning in test valid_test_coverage (models/marts/tests/testing.yml)
01:03:48 Got 1 result, configured to warn if != 0
01:03:48 compiled Code at /app/dbt_project/__local_target/compiled/dbt_project_evaluator/models/marts/tests/testing.yml/valid_test_coverage.sql
01:03:48 Warning in test is_empty_fct_missing_primary_key_tests_ (models/marts/tests/testing.yml)
01:03:48 Got 1 result, configured to warn if != 0
01:03:48 compiled Code at /app/dbt_project/__local_target/compiled/dbt_project_evaluator/models/marts/tests/testing.yml/is_empty_fct_missing_primary_key_tests_.sql
01:03:48 Done. PASS=59 WARN=2 ERROR=0 SKIP=0 TOTAL=61
System information
packages:
- package: dbt-labs/dbt_utils
version: 1.1.1
- package: dbt-labs/dbt_project_evaluator
version: 0.8.0
Which database are you using dbt with?
- [ ] postgres
- [x] redshift
- [ ] bigquery
- [ ] snowflake
- [ ] trino/starburst
- [ ] other (specify: ____________)
The output of dbt --version
:
dbt Cloud CLI - 0.34.16 (b16ec451ab12948f2c88d41fa851928511a99d43 2023-11-28T18:04:22Z)
Additional context
Are you interested in contributing the fix?
Thanks for raising this! This is due to the fact that the print()
function behaves differently in dbt Core and dbt Cloud. I am checking with the team if there is a way to update the print()
behaviour.
I will keep it open for now and will think of a long term solution.
@b-per thanks for the reply! On dbt Cloud should behave correctly? I haven't tested there.
I don't think that dbt Cloud IDE will show the print()
results either. I don't know about the dbt Cloud jobs.
@b-per is there any way to identify the detected resources to simplify the next steps? Otherwise we need to go file by file
Hi @sn-nsoria
What do you mean here?
Hi @b-per - thanks for replying. I mean, when I got a warn alert for example for some of the rules, how can I identify which models / tables / objects are not following the rule so we can go and fix it? Thanks
Most of the tests (if not all), should start with is_empty_fct_abcd
.
To see the failing records, you can:
- use
print_dbt_project_evaluator_issues
(which it seems does not work in the IDE and the Cloud CLI) but might work for jobs in dbt Cloud - or directly query the table
fct_abcd
that has been created in the warehouse