From ed1ff2caac5b87ae4fd6480fc1a11de6e03555be Mon Sep 17 00:00:00 2001 From: Emilie Lima Schario <14057155+emilieschario@users.noreply.github.com> Date: Mon, 29 Nov 2021 05:20:01 -0500 Subject: [PATCH] Adjust logic when finding approx matches for model or test matching (#4076) * adjust logic when finding approx matches * update changelog * Update core/dbt/adapters/base/relation.py Co-authored-by: Jeremy Cohen * Update changelog Co-authored-by: Jeremy Cohen Co-authored-by: Jeremy Cohen --- CHANGELOG.md | 4 +++- core/dbt/adapters/base/relation.py | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae96d456ac4..3d9c3ca586e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,11 @@ - Change some CompilationExceptions to ParsingExceptions ([#4254](http://github.com/dbt-labs/dbt-core/issues/4254), [#4328](https://github.com/dbt-core/pull/4328)) - Reorder logic for static parser sampling to speed up model parsing ([#4332](https://github.com/dbt-labs/dbt-core/pull/4332)) - Use more augmented assignment statements ([#4315](https://github.com/dbt-labs/dbt-core/issues/4315)), ([#4311](https://github.com/dbt-labs/dbt-core/pull/4331)) +- Adjust logic when finding approximate matches for models and tests ([#3835](https://github.com/dbt-labs/dbt-core/issues/3835)), [#4076](https://github.com/dbt-labs/dbt-core/pull/4076)) Contributors: -[@sarah-weatherbee](https://github.com/sarah-weatherbee) ([#4331](https://github.com/dbt-labs/dbt-core/pull/4331)) +- [@sarah-weatherbee](https://github.com/sarah-weatherbee) ([#4331](https://github.com/dbt-labs/dbt-core/pull/4331)) +- [@emilieschario](https://github.com/emilieschario) ([#4076](https://github.com/dbt-labs/dbt-core/pull/4076)) ## dbt-core 1.0.0rc2 (November 22, 2021) diff --git a/core/dbt/adapters/base/relation.py b/core/dbt/adapters/base/relation.py index 9f89d82a9b1..672348f4285 100644 --- a/core/dbt/adapters/base/relation.py +++ b/core/dbt/adapters/base/relation.py @@ -89,7 +89,10 @@ def matches( if not self._is_exactish_match(k, v): exact_match = False - if self.path.get_lowered_part(k) != v.lower(): + if ( + self.path.get_lowered_part(k).strip(self.quote_character) != + v.lower().strip(self.quote_character) + ): approximate_match = False if approximate_match and not exact_match: