Skip to content

Commit

Permalink
strip comment when sql statment start with SET (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
tovganesh authored Dec 5, 2022
1 parent f293ba9 commit 149c7ad
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions dbt/adapters/hive/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,15 @@ def add_query(
additional_info = {}
logger.debug(f"Unable to get query header {ex}")

strip_sql = sql.split("*/")
if len(strip_sql) > 1:
strip_sql = strip_sql[1]
else:
strip_sql = strip_sql[0]

if strip_sql.strip().lower().startswith("set"):
sql = strip_sql

with self.exception_handler(sql):
if abridge_sql_log:
log_sql = "{}...".format(sql[:512])
Expand Down

0 comments on commit 149c7ad

Please sign in to comment.