summaryrefslogtreecommitdiffstats
path: root/sqlglot/dialects/dialect.py
diff options
context:
space:
mode:
Diffstat (limited to 'sqlglot/dialects/dialect.py')
-rw-r--r--sqlglot/dialects/dialect.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/sqlglot/dialects/dialect.py b/sqlglot/dialects/dialect.py
index 531c72a..46661cf 100644
--- a/sqlglot/dialects/dialect.py
+++ b/sqlglot/dialects/dialect.py
@@ -2,7 +2,7 @@ from enum import Enum
from sqlglot import exp
from sqlglot.generator import Generator
-from sqlglot.helper import list_get
+from sqlglot.helper import flatten, list_get
from sqlglot.parser import Parser
from sqlglot.time import format_time
from sqlglot.tokens import Tokenizer
@@ -67,6 +67,11 @@ class _Dialect(type):
klass.generator_class.TRANSFORMS[
exp.HexString
] = lambda self, e: f"{hs_start}{int(self.sql(e, 'this')):X}{hs_end}"
+ if klass.tokenizer_class._BYTE_STRINGS and exp.ByteString not in klass.generator_class.TRANSFORMS:
+ be_start, be_end = list(klass.tokenizer_class._BYTE_STRINGS.items())[0]
+ klass.generator_class.TRANSFORMS[
+ exp.ByteString
+ ] = lambda self, e: f"{be_start}{self.sql(e, 'this')}{be_end}"
return klass
@@ -176,11 +181,7 @@ class Dialect(metaclass=_Dialect):
def rename_func(name):
def _rename(self, expression):
- args = (
- expression.expressions
- if isinstance(expression, exp.Func) and expression.is_var_len_args
- else expression.args.values()
- )
+ args = flatten(expression.args.values())
return f"{name}({self.format_args(*args)})"
return _rename