Skip to content

Commit

Permalink
make dbt_includes and dbt_excludes case insensitive (#123)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
Leo Folsom and gouline authored Jul 9, 2022
1 parent de5574c commit 5651b6b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions dbtmetabase/parsers/dbt_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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] = []

Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 5651b6b

Please sign in to comment.