Skip to content

Commit

Permalink
fix: has_unsupported_rule should not interfere selections
Browse files Browse the repository at this point in the history
  • Loading branch information
datnguye committed Mar 30, 2024
1 parent e1cebc2 commit 1c12f04
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions dbterd/adapters/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,8 @@ def evaluate_kwargs(self, **kwargs) -> dict:

select = list(kwargs.get("select")) or []
exclude = list(kwargs.get("exclude")) or []
select.extend(exclude)

unsupported, rule = has_unsupported_rule(rules=select)
if unsupported:
message = f"Unsupported Selection found: {rule}"
logger.error(message)
raise click.UsageError(message)

self.__check_if_any_unsupported_selection(select, exclude)
if command == "run":
if kwargs.get("dbt"):
logger.info(f"Using dbt project dir at: {dbt_project_dir}")
Expand All @@ -86,6 +80,26 @@ def evaluate_kwargs(self, **kwargs) -> dict:

return kwargs

def __check_if_any_unsupported_selection(
self, select: list = [], exclude: list = []
):
"""Throw an error if detected any supported selections
Args:
select (list, optional): Select rules. Defaults to [].
exclude (list, optional): Exclude rules. Defaults to [].
Raises:
click.UsageError: Unsupported selection
"""
rules = list(select)
rules.extend(exclude)
unsupported, rule = has_unsupported_rule(rules=rules)
if unsupported:
message = f"Unsupported Selection found: {rule}"
logger.error(message)
raise click.UsageError(message)

def __get_dir(self, **kwargs) -> str:
"""Calculate the dbt artifact directory and dbt project directory
Expand Down

0 comments on commit 1c12f04

Please sign in to comment.