diff options
Diffstat (limited to '')
-rw-r--r-- | sqlglot/dialects/oracle.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/sqlglot/dialects/oracle.py b/sqlglot/dialects/oracle.py index 144dba5..3bc1109 100644 --- a/sqlglot/dialects/oracle.py +++ b/sqlglot/dialects/oracle.py @@ -1,8 +1,9 @@ -from sqlglot import exp, transforms +from __future__ import annotations + +from sqlglot import exp, generator, tokens, transforms from sqlglot.dialects.dialect import Dialect, no_ilike_sql -from sqlglot.generator import Generator from sqlglot.helper import csv -from sqlglot.tokens import Tokenizer, TokenType +from sqlglot.tokens import TokenType def _limit_sql(self, expression): @@ -36,9 +37,9 @@ class Oracle(Dialect): "YYYY": "%Y", # 2015 } - class Generator(Generator): + class Generator(generator.Generator): TYPE_MAPPING = { - **Generator.TYPE_MAPPING, + **generator.Generator.TYPE_MAPPING, exp.DataType.Type.TINYINT: "NUMBER", exp.DataType.Type.SMALLINT: "NUMBER", exp.DataType.Type.INT: "NUMBER", @@ -49,11 +50,12 @@ class Oracle(Dialect): exp.DataType.Type.NVARCHAR: "NVARCHAR2", exp.DataType.Type.TEXT: "CLOB", exp.DataType.Type.BINARY: "BLOB", + exp.DataType.Type.VARBINARY: "BLOB", } TRANSFORMS = { - **Generator.TRANSFORMS, - **transforms.UNALIAS_GROUP, + **generator.Generator.TRANSFORMS, + **transforms.UNALIAS_GROUP, # type: ignore exp.ILike: no_ilike_sql, exp.Limit: _limit_sql, exp.StrToTime: lambda self, e: f"TO_TIMESTAMP({self.sql(e, 'this')}, {self.format_time(e)})", @@ -86,9 +88,9 @@ class Oracle(Dialect): def table_sql(self, expression): return super().table_sql(expression, sep=" ") - class Tokenizer(Tokenizer): + class Tokenizer(tokens.Tokenizer): KEYWORDS = { - **Tokenizer.KEYWORDS, + **tokens.Tokenizer.KEYWORDS, "TOP": TokenType.TOP, "VARCHAR2": TokenType.VARCHAR, "NVARCHAR2": TokenType.NVARCHAR, |