Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an optional parameter for quoting db/schema #400

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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