diff options
Diffstat (limited to 'sqlglot/dialects/dialect.py')
-rw-r--r-- | sqlglot/dialects/dialect.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/sqlglot/dialects/dialect.py b/sqlglot/dialects/dialect.py index aea792a..8e11050 100644 --- a/sqlglot/dialects/dialect.py +++ b/sqlglot/dialects/dialect.py @@ -169,6 +169,7 @@ class _Dialect(type): if enum not in ("", "athena", "presto", "trino"): klass.generator_class.TRY_SUPPORTED = False + klass.generator_class.SUPPORTS_UESCAPE = False if enum not in ("", "databricks", "hive", "spark", "spark2"): modifier_transforms = klass.generator_class.AFTER_HAVING_MODIFIER_TRANSFORMS.copy() @@ -177,6 +178,14 @@ class _Dialect(type): klass.generator_class.AFTER_HAVING_MODIFIER_TRANSFORMS = modifier_transforms + if enum not in ("", "doris", "mysql"): + klass.parser_class.ID_VAR_TOKENS = klass.parser_class.ID_VAR_TOKENS | { + TokenType.STRAIGHT_JOIN, + } + klass.parser_class.TABLE_ALIAS_TOKENS = klass.parser_class.TABLE_ALIAS_TOKENS | { + TokenType.STRAIGHT_JOIN, + } + if not klass.SUPPORTS_SEMI_ANTI_JOIN: klass.parser_class.TABLE_ALIAS_TOKENS = klass.parser_class.TABLE_ALIAS_TOKENS | { TokenType.ANTI, @@ -220,6 +229,9 @@ class Dialect(metaclass=_Dialect): SUPPORTS_SEMI_ANTI_JOIN = True """Whether `SEMI` or `ANTI` joins are supported.""" + SUPPORTS_COLUMN_JOIN_MARKS = False + """Whether the old-style outer join (+) syntax is supported.""" + NORMALIZE_FUNCTIONS: bool | str = "upper" """ Determines how function names are going to be normalized. @@ -1178,3 +1190,16 @@ def build_default_decimal_type( return exp.DataType.build(f"DECIMAL({params})") return _builder + + +def build_timestamp_from_parts(args: t.List) -> exp.Func: + if len(args) == 2: + # Other dialects don't have the TIMESTAMP_FROM_PARTS(date, time) concept, + # so we parse this into Anonymous for now instead of introducing complexity + return exp.Anonymous(this="TIMESTAMP_FROM_PARTS", expressions=args) + + return exp.TimestampFromParts.from_arg_list(args) + + +def sha256_sql(self: Generator, expression: exp.SHA2) -> str: + return self.func(f"SHA{expression.text('length') or '256'}", expression.this) |