From 5651b6bff9550ba672cc8695fcef68232fed9bdb Mon Sep 17 00:00:00 2001 From: Leo Folsom Date: Sat, 9 Jul 2022 04:51:11 -0700 Subject: [PATCH] make dbt_includes and dbt_excludes case insensitive (#123) * make dbt_includes case insensitive * transform excludes list to upper * add special_type option to MetabaseColumn * switch includes and excludes to lowercase and compare to model_name.lower() * remove debug shenanigans * remove addtl debug logger * avoid list coprehension crash warning if includes or excludes is None * revert special_type meta field change * black formatting for dbt_manifest.py * iterate through includes and excludes variables instead of self.includes and self.excludes * avoid assignment and then reprocessing of includes and excludes, just do it all on one line * remove repetitive if None check for includes and excludes Co-authored-by: Mike Gouline <1960272+gouline@users.noreply.github.com> --- dbtmetabase/parsers/dbt_manifest.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/dbtmetabase/parsers/dbt_manifest.py b/dbtmetabase/parsers/dbt_manifest.py index ebe7d708..f043c74a 100644 --- a/dbtmetabase/parsers/dbt_manifest.py +++ b/dbtmetabase/parsers/dbt_manifest.py @@ -28,17 +28,13 @@ def read_models( database = self.database schema = self.schema schema_excludes = self.schema_excludes - includes = self.includes - excludes = self.excludes + includes = [x.lower() for x in self.includes] if self.includes else [] + excludes = [x.lower() for x in self.excludes] if self.excludes else [] manifest = {} if schema_excludes is None: schema_excludes = [] - if includes is None: - includes = [] - if excludes is None: - excludes = [] mb_models: List[MetabaseModel] = [] @@ -88,7 +84,9 @@ def read_models( ) continue - if (includes and model_name not in includes) or (model_name in excludes): + if (includes and model_name.lower() not in includes) or ( + model_name.lower() in excludes + ): # Process only intersect of includes and excludes logger().debug( "Skipping %s not included in includes or excluded by excludes", @@ -141,7 +139,9 @@ def read_models( ) continue - if (includes and model_name not in includes) or (model_name in excludes): + if (includes and model_name.lower() not in includes) or ( + model_name.lower() in excludes + ): # Process only intersect of includes and excludes logger().debug( "Skipping %s not included in includes or excluded by excludes",