Skip to content

Commit

Permalink
Revert "skip removing comments if not needed"
Browse files Browse the repository at this point in the history
This reverts commit db17e4b.
  • Loading branch information
mariusandra committed Apr 26, 2024
1 parent 881724e commit 59a5786
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions posthog/clickhouse/client/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,7 @@ def _prepare_query(
rendered_sql = substitute_params(query, args)
prepared_args = None

if "--" in rendered_sql or "/*" in rendered_sql:
# This can take a very long time with e.g. large funnel queries
formatted_sql = sqlparse.format(rendered_sql, reindent_aligned=True)
else:
formatted_sql = rendered_sql
formatted_sql = sqlparse.format(rendered_sql, strip_comments=True)
annotated_sql, tags = _annotate_tagged_query(formatted_sql, workload)

if app_settings.SHELL_PLUS_PRINT_SQL:
Expand All @@ -231,11 +227,7 @@ def _annotate_tagged_query(query, workload):


def format_sql(rendered_sql, colorize=True):
if "--" in rendered_sql or "/*" in rendered_sql:
# This can take a very long time with e.g. large funnel queries
formatted_sql = sqlparse.format(rendered_sql, reindent_aligned=True)
else:
formatted_sql = rendered_sql
formatted_sql = sqlparse.format(rendered_sql, reindent_aligned=True)
if colorize:
try:
import pygments.formatters
Expand Down

0 comments on commit 59a5786

Please sign in to comment.