From 59a5786eec226f934d78cc86bd6246b6138ba007 Mon Sep 17 00:00:00 2001 From: Marius Andra Date: Fri, 26 Apr 2024 14:05:29 +0200 Subject: [PATCH] Revert "skip removing comments if not needed" This reverts commit db17e4b48187c9a03b8654b746e75a7f790318be. --- posthog/clickhouse/client/execute.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/posthog/clickhouse/client/execute.py b/posthog/clickhouse/client/execute.py index a149b982f4a8d..17af5683a6f19 100644 --- a/posthog/clickhouse/client/execute.py +++ b/posthog/clickhouse/client/execute.py @@ -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: @@ -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