diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-10-25 16:01:47 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-10-25 16:01:47 +0000 |
commit | be33e8ff4eed68ad217f9ef6ad535206df4129f8 (patch) | |
tree | 752695efdccc8387e37e233c900ce7c3c8f1aaff /sqlglot/generator.py | |
parent | Releasing debian version 9.0.1-1. (diff) | |
download | sqlglot-be33e8ff4eed68ad217f9ef6ad535206df4129f8.tar.xz sqlglot-be33e8ff4eed68ad217f9ef6ad535206df4129f8.zip |
Merging upstream version 9.0.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/generator.py')
-rw-r--r-- | sqlglot/generator.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sqlglot/generator.py b/sqlglot/generator.py index 6decd16..1784287 100644 --- a/sqlglot/generator.py +++ b/sqlglot/generator.py @@ -47,7 +47,8 @@ class Generator: The default is on the smaller end because the length only represents a segment and not the true line length. Default: 80 - annotations: Whether or not to show annotations in the SQL. + annotations: Whether or not to show annotations in the SQL when `pretty` is True. + Annotations can only be shown in pretty mode otherwise they may clobber resulting sql. Default: True """ @@ -280,7 +281,7 @@ class Generator: raise ValueError(f"Unsupported expression type {expression.__class__.__name__}") def annotation_sql(self, expression): - if self._annotations: + if self._annotations and self.pretty: return f"{self.sql(expression, 'expression')} # {expression.name}" return self.sql(expression, "expression") |