File tree Expand file tree Collapse file tree 4 files changed +24
-0
lines changed
Expand file tree Collapse file tree 4 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 3030from sqlglot .generator import unsupported_args
3131from sqlglot .helper import seq_get
3232from sqlglot .tokens import TokenType
33+ from sqlglot .typing .mysql import EXPRESSION_METADATA
3334
3435
3536def _show_parser (* args : t .Any , ** kwargs : t .Any ) -> t .Callable [[MySQL .Parser ], exp .Show ]:
@@ -166,6 +167,8 @@ class MySQL(Dialect):
166167 SAFE_TO_ELIMINATE_DOUBLE_NEGATION = False
167168 LEAST_GREATEST_IGNORES_NULLS = False
168169
170+ EXPRESSION_METADATA = EXPRESSION_METADATA .copy ()
171+
169172 # https://prestodb.io/docs/current/functions/datetime.html#mysql-date-functions
170173 TIME_MAPPING = {
171174 "%M" : "%B" ,
Original file line number Diff line number Diff line change 144144 expr_type : {"returns" : exp .DataType .Type .TIME }
145145 for expr_type in {
146146 exp .CurrentTime ,
147+ exp .Localtime ,
147148 exp .Time ,
148149 exp .TimeAdd ,
149150 exp .TimeSub ,
Original file line number Diff line number Diff line change 1+ from __future__ import annotations
2+
3+ from sqlglot import exp
4+ from sqlglot .typing import EXPRESSION_METADATA
5+
6+ EXPRESSION_METADATA = {
7+ ** EXPRESSION_METADATA ,
8+ exp .Localtime : {"returns" : exp .DataType .Type .DATETIME },
9+ }
Original file line number Diff line number Diff line change @@ -22,6 +22,9 @@ DOUBLE;
2222CURRENT_TIME ();
2323TIME ;
2424
25+ LOCALTIME();
26+ TIME ;
27+
2528TIME_ADD(CAST(' 09:05:03' AS TIME ), INTERVAL 2 HOUR);
2629TIME ;
2730
@@ -4831,3 +4834,11 @@ TIMESTAMPTZ;
48314834# dialect: tsql
48324835RADIANS(90 );
48334836INT ;
4837+
4838+ -- ------------------------------------
4839+ -- MySQL
4840+ -- ------------------------------------
4841+
4842+ # dialect: mysql
4843+ LOCALTIME;
4844+ DATETIME;
You can’t perform that action at this time.
0 commit comments