From 3ae8e745075fadfd2fe8e3ca2a03026a113d3b7d Mon Sep 17 00:00:00 2001 From: Yasuhisa Yoshida Date: Wed, 7 Feb 2024 11:49:57 +0900 Subject: [PATCH] Lowercase node_name in comparison to match even if it is uppercase (#74) * Lowercase node_name in comparison to match even if it is uppercase * Add test cases --- dbterd/adapters/filter.py | 2 +- tests/unit/adapters/test_filter.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/dbterd/adapters/filter.py b/dbterd/adapters/filter.py index aa1e56f..d2bc9fd 100644 --- a/dbterd/adapters/filter.py +++ b/dbterd/adapters/filter.py @@ -113,7 +113,7 @@ def is_satisfied_by_exact(table: Table, rule: str = ""): """ if not rule: return True - return table.node_name == rule + return table.node_name.lower() == rule def is_satisfied_by_schema(table: Table, rule: str = ""): diff --git a/tests/unit/adapters/test_filter.py b/tests/unit/adapters/test_filter.py index 12d5426..e8f3479 100644 --- a/tests/unit/adapters/test_filter.py +++ b/tests/unit/adapters/test_filter.py @@ -53,6 +53,16 @@ def test_has_unsupported_rule(self, rule, expected): "model.dummy.table1", True, ), + ( + Table( + name="irrelevant", + node_name="model.dummy.Table1", + database="dummydb", + schema="dummyschema", + ), + "model.dummy.table1", + True, + ), ], ) def test_is_satisfied_by_exact(self, table, rule, expected):