Skip to content

Commit

Permalink
add fix for no whitespace in source or ref
Browse files Browse the repository at this point in the history
  • Loading branch information
z3z1ma committed Apr 18, 2022
1 parent cc144b9 commit e28812c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pre_commit_dbt/check_script_has_no_table_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,17 @@ def add_space_to_parenthesis(sql: str) -> str:
return re.sub(REGEX_PARENTHESIS, r" \1 ", sql)


def add_space_to_source_ref(sql: str) -> str:
return sql.replace("{{", "{{ ").replace("}}", " }}")


def has_table_name(
sql: str, filename: str, dotless: Optional[bool] = False
) -> Tuple[int, Set[str]]:
status_code = 0
sql_clean = replace_comments(sql)
sql_clean = add_space_to_parenthesis(sql_clean)
sql_clean = add_space_to_source_ref(sql_clean)
sql_split = re.split(REGEX_SPLIT, sql_clean)
tables = set()
cte = set()
Expand Down

0 comments on commit e28812c

Please sign in to comment.