Merging upstream version 10.6.3.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
d03a55eda6
commit
ece6881255
48 changed files with 906 additions and 266 deletions
|
@ -1,7 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import typing as t
|
||||
|
||||
from sqlglot import exp, generator, parser, tokens
|
||||
from sqlglot.dialects.dialect import (
|
||||
Dialect,
|
||||
|
@ -98,6 +96,8 @@ def _date_add_sql(kind):
|
|||
|
||||
|
||||
class MySQL(Dialect):
|
||||
time_format = "'%Y-%m-%d %T'"
|
||||
|
||||
# https://prestodb.io/docs/current/functions/datetime.html#mysql-date-functions
|
||||
time_mapping = {
|
||||
"%M": "%B",
|
||||
|
@ -110,6 +110,7 @@ class MySQL(Dialect):
|
|||
"%u": "%W",
|
||||
"%k": "%-H",
|
||||
"%l": "%-I",
|
||||
"%T": "%H:%M:%S",
|
||||
}
|
||||
|
||||
class Tokenizer(tokens.Tokenizer):
|
||||
|
@ -428,6 +429,7 @@ class MySQL(Dialect):
|
|||
)
|
||||
|
||||
class Generator(generator.Generator):
|
||||
LOCKING_READS_SUPPORTED = True
|
||||
NULL_ORDERING_SUPPORTED = False
|
||||
|
||||
TRANSFORMS = {
|
||||
|
@ -449,23 +451,12 @@ class MySQL(Dialect):
|
|||
exp.StrPosition: strposition_to_locate_sql,
|
||||
}
|
||||
|
||||
ROOT_PROPERTIES = {
|
||||
exp.EngineProperty,
|
||||
exp.AutoIncrementProperty,
|
||||
exp.CharacterSetProperty,
|
||||
exp.CollateProperty,
|
||||
exp.SchemaCommentProperty,
|
||||
exp.LikeProperty,
|
||||
}
|
||||
|
||||
TYPE_MAPPING = generator.Generator.TYPE_MAPPING.copy()
|
||||
TYPE_MAPPING.pop(exp.DataType.Type.MEDIUMTEXT)
|
||||
TYPE_MAPPING.pop(exp.DataType.Type.LONGTEXT)
|
||||
TYPE_MAPPING.pop(exp.DataType.Type.MEDIUMBLOB)
|
||||
TYPE_MAPPING.pop(exp.DataType.Type.LONGBLOB)
|
||||
|
||||
WITH_PROPERTIES: t.Set[t.Type[exp.Property]] = set()
|
||||
|
||||
def show_sql(self, expression):
|
||||
this = f" {expression.name}"
|
||||
full = " FULL" if expression.args.get("full") else ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue