Skip to content

Commit

Permalink
Merge pull request #400 from dbt-labs/fix/399
Browse files Browse the repository at this point in the history
Add an optional parameter for quoting db/schema
  • Loading branch information
b-per authored Dec 11, 2023
2 parents a1a6d01 + 1fad085 commit 6872d96
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion docs/customization/issues-in-log.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ To use it, you can add the following line in your `dbt_project.yml`:
on-run-end: "{{ dbt_project_evaluator.print_dbt_project_evaluator_issues() }}"
```
The macro accepts a parameter to pick between 2 types of formatting, `format='table'` (default) or `format='csv'`
The macro accepts two parameters:
- to pick between 2 types of formatting, set `format='table'` (default) or `format='csv'`
- to add quotes to the database and schema (default = no quote), set ``quote='`'`` or `quote='"'`
6 changes: 3 additions & 3 deletions macros/on-run-end/print_dbt_project_evaluator_issues.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% macro print_dbt_project_evaluator_issues(format='table') %}
{% macro print_dbt_project_evaluator_issues(format='table', quote="") %}

{%- if flags.WHICH in ["build","test"] -%}
{{ print("\n### List of issues raised by dbt_project_evaluator ###") }}
Expand All @@ -13,8 +13,8 @@

{% set model_details = graph["nodes"][unique_id_model_checked] %}
{% set name_model_checked = model_details.alias %}
{% set model_schema = model_details.schema %}
{% set model_database = model_details.database %}
{% set model_schema = quote ~ model_details.schema ~ quote %}
{% set model_database = quote ~ model_details.database ~ quote if model_details.database else None %}
{% set db_schema = model_database ~ "." ~ model_schema if model_database else model_schema %}

{% set sql_statement %}
Expand Down

0 comments on commit 6872d96

Please sign in to comment.