From a80594965d3756b4fe649f2896b84334bd4a8e97 Mon Sep 17 00:00:00 2001 From: Gary James Date: Tue, 25 Jan 2022 15:36:58 +0000 Subject: [PATCH] Feature - Allow conversion of column names to lower case to be configured (#22) * Update README.md * Update evaluate_required_docs.sql * Update macros/utils/required_docs/evaluate_required_docs.sql Co-authored-by: Teghan Nightengale --- README.md | 4 ++++ macros/utils/required_docs/evaluate_required_docs.sql | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index eea233f..a4f8d8e 100644 --- a/README.md +++ b/README.md @@ -274,6 +274,10 @@ dbt run-operation required_docs [--args "{'models': ''}" ``` **Note:** Run this command _after_ `dbt run`: only models that already exist in the warehouse can be validated for columns that are missing from the model `.yml`. +By default, column names are assumed to be lower case in the DBT documentation, +if this is not the case in your project, setting the variable +`convert_column_names_to_lower_case` to `false` in `dbt_project.yml` will +compare the column names in the case they appear. ## Contributions Feedback on this project is welcomed and encouraged. Please open an issue or diff --git a/macros/utils/required_docs/evaluate_required_docs.sql b/macros/utils/required_docs/evaluate_required_docs.sql index 383934c..f89f05b 100644 --- a/macros/utils/required_docs/evaluate_required_docs.sql +++ b/macros/utils/required_docs/evaluate_required_docs.sql @@ -28,7 +28,9 @@ {% for column in model_columns %} - {% set column = column | lower %} + {% if var("convert_column_names_to_lower_case", true) %} + {% set column = column | lower %} + {% endif %} {% if column in model.columns.keys() %}