sqlglot 27.27.0__py3-none-any.whl → 27.28.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of sqlglot might be problematic. Click here for more details.

sqlglot/_version.py CHANGED
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '27.27.0'
32
- __version_tuple__ = version_tuple = (27, 27, 0)
31
+ __version__ = version = '27.28.1'
32
+ __version_tuple__ = version_tuple = (27, 28, 1)
33
33
 
34
34
  __commit_id__ = commit_id = None
@@ -496,6 +496,115 @@ class BigQuery(Dialect):
496
496
  # BigQuery maps Type.TIMESTAMP to DATETIME, so we need to amend the inferred types
497
497
  TYPE_TO_EXPRESSIONS = {
498
498
  **Dialect.TYPE_TO_EXPRESSIONS,
499
+ exp.DataType.Type.BIGINT: {
500
+ *Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.BIGINT],
501
+ exp.Ascii,
502
+ exp.BitwiseAndAgg,
503
+ exp.BitwiseOrAgg,
504
+ exp.BitwiseXorAgg,
505
+ exp.BitwiseCount,
506
+ exp.ByteLength,
507
+ exp.DenseRank,
508
+ exp.FarmFingerprint,
509
+ exp.Grouping,
510
+ exp.LaxInt64,
511
+ exp.Ntile,
512
+ exp.Rank,
513
+ exp.RangeBucket,
514
+ exp.RegexpInstr,
515
+ exp.RowNumber,
516
+ exp.Unicode,
517
+ },
518
+ exp.DataType.Type.BINARY: {
519
+ *Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.BINARY],
520
+ exp.ByteString,
521
+ exp.CodePointsToBytes,
522
+ exp.MD5Digest,
523
+ exp.SHA,
524
+ exp.SHA2,
525
+ exp.Unhex,
526
+ },
527
+ exp.DataType.Type.BOOLEAN: {
528
+ *Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.BOOLEAN],
529
+ exp.IsInf,
530
+ exp.IsNan,
531
+ exp.JSONBool,
532
+ exp.LaxBool,
533
+ },
534
+ exp.DataType.Type.DATE: {
535
+ *Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.DATE],
536
+ exp.DateFromUnixDate,
537
+ },
538
+ exp.DataType.Type.DATETIME: {
539
+ *Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.DATETIME],
540
+ exp.ParseDatetime,
541
+ exp.TimestampFromParts,
542
+ },
543
+ exp.DataType.Type.DECIMAL: {
544
+ exp.ParseNumeric,
545
+ },
546
+ exp.DataType.Type.BIGDECIMAL: {
547
+ exp.ParseBignumeric,
548
+ },
549
+ exp.DataType.Type.DOUBLE: {
550
+ *Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.DOUBLE],
551
+ exp.Acos,
552
+ exp.Acosh,
553
+ exp.Asin,
554
+ exp.Asinh,
555
+ exp.Atan,
556
+ exp.Atanh,
557
+ exp.Atan2,
558
+ exp.Cbrt,
559
+ exp.Corr,
560
+ exp.Cot,
561
+ exp.CosineDistance,
562
+ exp.Coth,
563
+ exp.CovarPop,
564
+ exp.CovarSamp,
565
+ exp.Csc,
566
+ exp.Csch,
567
+ exp.CumeDist,
568
+ exp.EuclideanDistance,
569
+ exp.Float64,
570
+ exp.LaxFloat64,
571
+ exp.PercentRank,
572
+ exp.Rand,
573
+ exp.Sec,
574
+ exp.Sech,
575
+ exp.Sin,
576
+ exp.Sinh,
577
+ },
578
+ exp.DataType.Type.JSON: {
579
+ *Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.JSON],
580
+ exp.JSONArray,
581
+ exp.JSONArrayAppend,
582
+ exp.JSONArrayInsert,
583
+ exp.JSONObject,
584
+ exp.JSONRemove,
585
+ exp.JSONSet,
586
+ exp.JSONStripNulls,
587
+ },
588
+ exp.DataType.Type.TIME: {
589
+ *Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.TIME],
590
+ exp.ParseTime,
591
+ exp.TimeFromParts,
592
+ exp.TimeTrunc,
593
+ exp.TsOrDsToTime,
594
+ },
595
+ exp.DataType.Type.VARCHAR: {
596
+ *Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.VARCHAR],
597
+ exp.CodePointsToString,
598
+ exp.Format,
599
+ exp.JSONExtractScalar,
600
+ exp.JSONType,
601
+ exp.LaxString,
602
+ exp.LowerHex,
603
+ exp.Normalize,
604
+ exp.SafeConvertBytesToString,
605
+ exp.Soundex,
606
+ exp.Uuid,
607
+ },
499
608
  exp.DataType.Type.TIMESTAMPTZ: Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.TIMESTAMP],
500
609
  }
501
610
  TYPE_TO_EXPRESSIONS.pop(exp.DataType.Type.TIMESTAMP)
@@ -545,64 +654,15 @@ class BigQuery(Dialect):
545
654
  exp.Upper,
546
655
  )
547
656
  },
548
- exp.Acos: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DOUBLE),
549
- exp.Acosh: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DOUBLE),
550
- exp.Asin: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DOUBLE),
551
- exp.Asinh: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DOUBLE),
552
- exp.Atan: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DOUBLE),
553
- exp.Atanh: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DOUBLE),
554
- exp.Atan2: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DOUBLE),
555
657
  exp.ApproxTopSum: lambda self, e: _annotate_by_args_approx_top(self, e),
556
658
  exp.ApproxTopK: lambda self, e: _annotate_by_args_approx_top(self, e),
557
659
  exp.ApproxQuantiles: lambda self, e: self._annotate_by_args(e, "this", array=True),
558
660
  exp.Array: _annotate_array,
559
661
  exp.ArrayConcat: lambda self, e: self._annotate_by_args(e, "this", "expressions"),
560
- exp.Ascii: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BIGINT),
561
- exp.BitwiseAndAgg: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BIGINT),
562
- exp.BitwiseOrAgg: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BIGINT),
563
- exp.BitwiseXorAgg: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BIGINT),
564
- exp.BitwiseCountAgg: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BIGINT),
565
- exp.ByteLength: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BIGINT),
566
- exp.ByteString: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BINARY),
567
- exp.Cbrt: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DOUBLE),
568
- exp.CodePointsToBytes: lambda self, e: self._annotate_with_type(
569
- e, exp.DataType.Type.BINARY
570
- ),
571
- exp.CodePointsToString: lambda self, e: self._annotate_with_type(
572
- e, exp.DataType.Type.VARCHAR
573
- ),
574
662
  exp.Concat: _annotate_concat,
575
- exp.Corr: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DOUBLE),
576
- exp.Cot: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DOUBLE),
577
- exp.CosineDistance: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DOUBLE),
578
- exp.Coth: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DOUBLE),
579
- exp.CovarPop: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DOUBLE),
580
- exp.CovarSamp: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DOUBLE),
581
- exp.Csc: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DOUBLE),
582
- exp.Csch: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DOUBLE),
583
- exp.CumeDist: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DOUBLE),
584
- exp.DateFromUnixDate: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DATE),
585
- exp.DenseRank: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BIGINT),
586
- exp.EuclideanDistance: lambda self, e: self._annotate_with_type(
587
- e, exp.DataType.Type.DOUBLE
588
- ),
589
- exp.FarmFingerprint: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BIGINT),
590
- exp.Unhex: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BINARY),
591
- exp.Float64: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DOUBLE),
592
- exp.Format: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.VARCHAR),
593
663
  exp.GenerateTimestampArray: lambda self, e: self._annotate_with_type(
594
664
  e, exp.DataType.build("ARRAY<TIMESTAMP>", dialect="bigquery")
595
665
  ),
596
- exp.Grouping: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BIGINT),
597
- exp.IsInf: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BOOLEAN),
598
- exp.IsNan: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BOOLEAN),
599
- exp.JSONArray: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.JSON),
600
- exp.JSONArrayAppend: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.JSON),
601
- exp.JSONArrayInsert: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.JSON),
602
- exp.JSONBool: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BOOLEAN),
603
- exp.JSONExtractScalar: lambda self, e: self._annotate_with_type(
604
- e, exp.DataType.Type.VARCHAR
605
- ),
606
666
  exp.JSONExtractArray: lambda self, e: self._annotate_by_args(e, "this", array=True),
607
667
  exp.JSONFormat: lambda self, e: self._annotate_with_type(
608
668
  e, exp.DataType.Type.JSON if e.args.get("to_json") else exp.DataType.Type.VARCHAR
@@ -610,62 +670,19 @@ class BigQuery(Dialect):
610
670
  exp.JSONKeysAtDepth: lambda self, e: self._annotate_with_type(
611
671
  e, exp.DataType.build("ARRAY<VARCHAR>", dialect="bigquery")
612
672
  ),
613
- exp.JSONObject: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.JSON),
614
- exp.JSONRemove: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.JSON),
615
- exp.JSONSet: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.JSON),
616
- exp.JSONStripNulls: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.JSON),
617
- exp.JSONType: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.VARCHAR),
618
673
  exp.JSONValueArray: lambda self, e: self._annotate_with_type(
619
674
  e, exp.DataType.build("ARRAY<VARCHAR>", dialect="bigquery")
620
675
  ),
621
676
  exp.Lag: lambda self, e: self._annotate_by_args(e, "this", "default"),
622
- exp.LowerHex: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.VARCHAR),
623
- exp.LaxBool: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BOOLEAN),
624
- exp.LaxFloat64: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DOUBLE),
625
- exp.LaxInt64: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BIGINT),
626
- exp.LaxString: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.VARCHAR),
627
- exp.MD5Digest: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BINARY),
628
- exp.Normalize: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.VARCHAR),
629
- exp.Ntile: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BIGINT),
630
- exp.ParseTime: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.TIME),
631
- exp.ParseDatetime: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DATETIME),
632
- exp.ParseBignumeric: lambda self, e: self._annotate_with_type(
633
- e, exp.DataType.Type.BIGDECIMAL
634
- ),
635
- exp.ParseNumeric: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DECIMAL),
636
677
  exp.PercentileCont: lambda self, e: _annotate_by_args_with_coerce(self, e),
637
- exp.PercentRank: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DOUBLE),
638
- exp.Rank: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BIGINT),
639
- exp.RangeBucket: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BIGINT),
640
678
  exp.RegexpExtractAll: lambda self, e: self._annotate_by_args(e, "this", array=True),
641
- exp.RegexpInstr: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BIGINT),
642
- exp.RowNumber: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BIGINT),
643
- exp.Rand: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DOUBLE),
644
- exp.SafeConvertBytesToString: lambda self, e: self._annotate_with_type(
645
- e, exp.DataType.Type.VARCHAR
646
- ),
647
679
  exp.SafeAdd: lambda self, e: _annotate_by_args_with_coerce(self, e),
648
680
  exp.SafeMultiply: lambda self, e: _annotate_by_args_with_coerce(self, e),
649
681
  exp.SafeSubtract: lambda self, e: _annotate_by_args_with_coerce(self, e),
650
- exp.Sec: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DOUBLE),
651
- exp.Sech: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DOUBLE),
652
- exp.Soundex: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.VARCHAR),
653
- exp.SHA: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BINARY),
654
- exp.SHA2: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BINARY),
655
- exp.Sin: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DOUBLE),
656
- exp.Sinh: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DOUBLE),
657
682
  exp.Split: lambda self, e: self._annotate_by_args(e, "this", array=True),
658
- exp.TimestampFromParts: lambda self, e: self._annotate_with_type(
659
- e, exp.DataType.Type.DATETIME
660
- ),
661
- exp.TimeFromParts: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.TIME),
662
- exp.TimeTrunc: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.TIME),
663
683
  exp.ToCodePoints: lambda self, e: self._annotate_with_type(
664
684
  e, exp.DataType.build("ARRAY<BIGINT>", dialect="bigquery")
665
685
  ),
666
- exp.TsOrDsToTime: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.TIME),
667
- exp.Unicode: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BIGINT),
668
- exp.Uuid: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.VARCHAR),
669
686
  }
670
687
 
671
688
  def normalize_identifier(self, expression: E) -> E:
@@ -786,7 +803,7 @@ class BigQuery(Dialect):
786
803
  "BIT_AND": exp.BitwiseAndAgg.from_arg_list,
787
804
  "BIT_OR": exp.BitwiseOrAgg.from_arg_list,
788
805
  "BIT_XOR": exp.BitwiseXorAgg.from_arg_list,
789
- "BIT_COUNT": exp.BitwiseCountAgg.from_arg_list,
806
+ "BIT_COUNT": exp.BitwiseCount.from_arg_list,
790
807
  "BOOL": exp.JSONBool.from_arg_list,
791
808
  "CONTAINS_SUBSTR": _build_contains_substring,
792
809
  "DATE": _build_date,
@@ -1302,7 +1319,7 @@ class BigQuery(Dialect):
1302
1319
  exp.BitwiseAndAgg: rename_func("BIT_AND"),
1303
1320
  exp.BitwiseOrAgg: rename_func("BIT_OR"),
1304
1321
  exp.BitwiseXorAgg: rename_func("BIT_XOR"),
1305
- exp.BitwiseCountAgg: rename_func("BIT_COUNT"),
1322
+ exp.BitwiseCount: rename_func("BIT_COUNT"),
1306
1323
  exp.ByteLength: rename_func("BYTE_LENGTH"),
1307
1324
  exp.Cast: transforms.preprocess([transforms.remove_precision_parameterized_types]),
1308
1325
  exp.CollateProperty: lambda self, e: (
@@ -1418,9 +1418,12 @@ class ClickHouse(Dialect):
1418
1418
  return in_sql
1419
1419
 
1420
1420
  def not_sql(self, expression: exp.Not) -> str:
1421
- if isinstance(expression.this, exp.In) and expression.this.args.get("is_global"):
1422
- # let `GLOBAL IN` child interpose `NOT`
1423
- return self.sql(expression, "this")
1421
+ if isinstance(expression.this, exp.In):
1422
+ if expression.this.args.get("is_global"):
1423
+ # let `GLOBAL IN` child interpose `NOT`
1424
+ return self.sql(expression, "this")
1425
+
1426
+ expression.set("this", exp.paren(expression.this, copy=False))
1424
1427
 
1425
1428
  return super().not_sql(expression)
1426
1429
 
@@ -1,5 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import re
3
4
  import typing as t
4
5
 
5
6
  from sqlglot import exp, generator, parser, tokens, transforms
@@ -44,6 +45,10 @@ from sqlglot.helper import seq_get
44
45
  from sqlglot.tokens import TokenType
45
46
  from sqlglot.parser import binary_range_parser
46
47
 
48
+ # Regex to detect time zones in timestamps of the form [+|-]TT[:tt]
49
+ # The pattern matches timezone offsets that appear after the time portion
50
+ TIMEZONE_PATTERN = re.compile(r":\d{2}.*?[+\-]\d{2}(?::\d{2})?")
51
+
47
52
 
48
53
  # BigQuery -> DuckDB conversion for the DATE function
49
54
  def _date_sql(self: DuckDB.Generator, expression: exp.Date) -> str:
@@ -211,7 +216,18 @@ def _arrow_json_extract_sql(self: DuckDB.Generator, expression: JSON_EXTRACT_TYP
211
216
  def _implicit_datetime_cast(
212
217
  arg: t.Optional[exp.Expression], type: exp.DataType.Type = exp.DataType.Type.DATE
213
218
  ) -> t.Optional[exp.Expression]:
214
- return exp.cast(arg, type) if isinstance(arg, exp.Literal) else arg
219
+ if isinstance(arg, exp.Literal) and arg.is_string:
220
+ ts = arg.name
221
+ if type == exp.DataType.Type.DATE and ":" in ts:
222
+ type = (
223
+ exp.DataType.Type.TIMESTAMPTZ
224
+ if TIMEZONE_PATTERN.search(ts)
225
+ else exp.DataType.Type.TIMESTAMP
226
+ )
227
+
228
+ arg = exp.cast(arg, type)
229
+
230
+ return arg
215
231
 
216
232
 
217
233
  def _date_diff_sql(self: DuckDB.Generator, expression: exp.DateDiff) -> str:
@@ -694,6 +710,7 @@ class DuckDB(Dialect):
694
710
  exp.DateDiff: _date_diff_sql,
695
711
  exp.DateStrToDate: datestrtodate_sql,
696
712
  exp.Datetime: no_datetime_sql,
713
+ exp.DatetimeDiff: _date_diff_sql,
697
714
  exp.DatetimeSub: date_delta_to_binary_interval_op(),
698
715
  exp.DatetimeAdd: date_delta_to_binary_interval_op(),
699
716
  exp.DateToDi: lambda self,
@@ -758,6 +775,7 @@ class DuckDB(Dialect):
758
775
  exp.Struct: _struct_sql,
759
776
  exp.Transform: rename_func("LIST_TRANSFORM"),
760
777
  exp.TimeAdd: date_delta_to_binary_interval_op(),
778
+ exp.TimeSub: date_delta_to_binary_interval_op(),
761
779
  exp.Time: no_time_sql,
762
780
  exp.TimeDiff: _timediff_sql,
763
781
  exp.Timestamp: no_timestamp_sql,
@@ -781,6 +799,7 @@ class DuckDB(Dialect):
781
799
  exp.cast(e.expression, exp.DataType.Type.TIMESTAMP),
782
800
  exp.cast(e.this, exp.DataType.Type.TIMESTAMP),
783
801
  ),
802
+ exp.UnixMicros: rename_func("EPOCH_US"),
784
803
  exp.UnixToStr: lambda self, e: self.func(
785
804
  "STRFTIME", self.func("TO_TIMESTAMP", e.this), self.format_time(e)
786
805
  ),
sqlglot/dialects/mysql.py CHANGED
@@ -325,7 +325,7 @@ class MySQL(Dialect):
325
325
  "BIT_AND": exp.BitwiseAndAgg.from_arg_list,
326
326
  "BIT_OR": exp.BitwiseOrAgg.from_arg_list,
327
327
  "BIT_XOR": exp.BitwiseXorAgg.from_arg_list,
328
- "BIT_COUNT": exp.BitwiseCountAgg.from_arg_list,
328
+ "BIT_COUNT": exp.BitwiseCount.from_arg_list,
329
329
  "CONVERT_TZ": lambda args: exp.ConvertTimezone(
330
330
  source_tz=seq_get(args, 1), target_tz=seq_get(args, 2), timestamp=seq_get(args, 0)
331
331
  ),
@@ -755,7 +755,7 @@ class MySQL(Dialect):
755
755
  exp.BitwiseAndAgg: rename_func("BIT_AND"),
756
756
  exp.BitwiseOrAgg: rename_func("BIT_OR"),
757
757
  exp.BitwiseXorAgg: rename_func("BIT_XOR"),
758
- exp.BitwiseCountAgg: rename_func("BIT_COUNT"),
758
+ exp.BitwiseCount: rename_func("BIT_COUNT"),
759
759
  exp.CurrentDate: no_paren_current_date_sql,
760
760
  exp.DateDiff: _remove_ts_or_ds_to_date(
761
761
  lambda self, e: self.func("DATEDIFF", e.this, e.expression), ("this", "expression")
@@ -23,6 +23,7 @@ from sqlglot.dialects.dialect import (
23
23
  rename_func,
24
24
  timestamptrunc_sql,
25
25
  timestrtotime_sql,
26
+ unit_to_str,
26
27
  var_map_sql,
27
28
  map_date_part,
28
29
  no_timestamp_sql,
@@ -41,6 +42,9 @@ if t.TYPE_CHECKING:
41
42
  from sqlglot._typing import E, B
42
43
 
43
44
 
45
+ DATE_PARTS = ["YEAR", "QUARTER", "MONTH", "WEEK", "DAY"]
46
+
47
+
44
48
  def _build_strtok(args: t.List) -> exp.SplitPart:
45
49
  # Add default delimiter (space) if missing - per Snowflake docs
46
50
  if len(args) == 1:
@@ -547,6 +551,19 @@ def _annotate_reverse(self: TypeAnnotator, expression: exp.Reverse) -> exp.Rever
547
551
  return expression
548
552
 
549
553
 
554
+ def _annotate_date_or_time_add(self: TypeAnnotator, expression: E) -> E:
555
+ self._annotate_args(expression)
556
+
557
+ if (
558
+ expression.this.is_type(exp.DataType.Type.DATE)
559
+ and expression.text("unit").upper() not in DATE_PARTS
560
+ ):
561
+ self._set_type(expression, exp.DataType.Type.TIMESTAMPNTZ)
562
+ else:
563
+ self._annotate_by_args(expression, "this")
564
+ return expression
565
+
566
+
550
567
  class Snowflake(Dialect):
551
568
  # https://docs.snowflake.com/en/sql-reference/identifiers-syntax
552
569
  NORMALIZATION_STRATEGY = NormalizationStrategy.UPPERCASE
@@ -570,6 +587,7 @@ class Snowflake(Dialect):
570
587
  exp.Cot,
571
588
  exp.Degrees,
572
589
  exp.Exp,
590
+ exp.MonthsBetween,
573
591
  exp.Sin,
574
592
  exp.Sinh,
575
593
  exp.Tan,
@@ -588,10 +606,14 @@ class Snowflake(Dialect):
588
606
  exp.Length,
589
607
  exp.RtrimmedLength,
590
608
  exp.BitLength,
609
+ exp.Hour,
591
610
  exp.Levenshtein,
592
611
  exp.JarowinklerSimilarity,
612
+ exp.Minute,
613
+ exp.Second,
593
614
  exp.StrPosition,
594
615
  exp.Unicode,
616
+ exp.WidthBucket,
595
617
  },
596
618
  exp.DataType.Type.VARCHAR: {
597
619
  *Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.VARCHAR],
@@ -610,6 +632,7 @@ class Snowflake(Dialect):
610
632
  exp.TryHexDecodeString,
611
633
  exp.HexEncode,
612
634
  exp.Initcap,
635
+ exp.Monthname,
613
636
  exp.RegexpExtract,
614
637
  exp.RegexpReplace,
615
638
  exp.Repeat,
@@ -640,6 +663,7 @@ class Snowflake(Dialect):
640
663
  exp.Factorial,
641
664
  exp.MD5NumberLower64,
642
665
  exp.MD5NumberUpper64,
666
+ exp.Rand,
643
667
  },
644
668
  exp.DataType.Type.ARRAY: {
645
669
  exp.Split,
@@ -655,8 +679,18 @@ class Snowflake(Dialect):
655
679
  },
656
680
  exp.DataType.Type.BOOLEAN: {
657
681
  *Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.BOOLEAN],
682
+ exp.Boolnot,
658
683
  exp.Search,
659
684
  },
685
+ exp.DataType.Type.DATE: {
686
+ *Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.DATE],
687
+ exp.NextDay,
688
+ exp.PreviousDay,
689
+ },
690
+ exp.DataType.Type.TIME: {
691
+ *Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.TIME],
692
+ exp.TimeFromParts,
693
+ },
660
694
  }
661
695
 
662
696
  ANNOTATORS = {
@@ -669,6 +703,7 @@ class Snowflake(Dialect):
669
703
  **{
670
704
  expr_type: lambda self, e: self._annotate_by_args(e, "this")
671
705
  for expr_type in (
706
+ exp.AddMonths,
672
707
  exp.Floor,
673
708
  exp.Left,
674
709
  exp.Pad,
@@ -677,6 +712,9 @@ class Snowflake(Dialect):
677
712
  exp.Substring,
678
713
  exp.Round,
679
714
  exp.Ceil,
715
+ exp.DateTrunc,
716
+ exp.TimeSlice,
717
+ exp.TimestampTrunc,
680
718
  )
681
719
  },
682
720
  **{
@@ -689,7 +727,15 @@ class Snowflake(Dialect):
689
727
  )
690
728
  },
691
729
  exp.ConcatWs: lambda self, e: self._annotate_by_args(e, "expressions"),
730
+ exp.ConvertTimezone: lambda self, e: self._annotate_with_type(
731
+ e,
732
+ exp.DataType.Type.TIMESTAMPNTZ
733
+ if e.args.get("source_tz")
734
+ else exp.DataType.Type.TIMESTAMPTZ,
735
+ ),
736
+ exp.DateAdd: _annotate_date_or_time_add,
692
737
  exp.Reverse: _annotate_reverse,
738
+ exp.TimeAdd: _annotate_date_or_time_add,
693
739
  }
694
740
 
695
741
  TIME_MAPPING = {
@@ -1078,8 +1124,11 @@ class Snowflake(Dialect):
1078
1124
  if not this:
1079
1125
  return None
1080
1126
 
1081
- self._match(TokenType.COMMA)
1082
- expression = self._parse_bitwise()
1127
+ # Handle both syntaxes: DATE_PART(part, expr) and DATE_PART(part FROM expr)
1128
+ expression = (
1129
+ self._match_set((TokenType.FROM, TokenType.COMMA)) and self._parse_bitwise()
1130
+ )
1131
+
1083
1132
  this = map_date_part(this)
1084
1133
  name = this.name.upper()
1085
1134
 
@@ -1545,6 +1594,13 @@ class Snowflake(Dialect):
1545
1594
  exp.Stuff: rename_func("INSERT"),
1546
1595
  exp.StPoint: rename_func("ST_MAKEPOINT"),
1547
1596
  exp.TimeAdd: date_delta_sql("TIMEADD"),
1597
+ exp.TimeSlice: lambda self, e: self.func(
1598
+ "TIME_SLICE",
1599
+ e.this,
1600
+ e.expression,
1601
+ unit_to_str(e),
1602
+ e.args.get("kind"),
1603
+ ),
1548
1604
  exp.Timestamp: no_timestamp_sql,
1549
1605
  exp.TimestampAdd: date_delta_sql("TIMESTAMPADD"),
1550
1606
  exp.TimestampDiff: lambda self, e: self.func(
sqlglot/dialects/spark.py CHANGED
@@ -128,7 +128,7 @@ class Spark(Spark2):
128
128
  "BIT_AND": exp.BitwiseAndAgg.from_arg_list,
129
129
  "BIT_OR": exp.BitwiseOrAgg.from_arg_list,
130
130
  "BIT_XOR": exp.BitwiseXorAgg.from_arg_list,
131
- "BIT_COUNT": exp.BitwiseCountAgg.from_arg_list,
131
+ "BIT_COUNT": exp.BitwiseCount.from_arg_list,
132
132
  "DATE_ADD": _build_dateadd,
133
133
  "DATEADD": _build_dateadd,
134
134
  "TIMESTAMPADD": _build_dateadd,
@@ -196,7 +196,7 @@ class Spark(Spark2):
196
196
  exp.BitwiseAndAgg: rename_func("BIT_AND"),
197
197
  exp.BitwiseOrAgg: rename_func("BIT_OR"),
198
198
  exp.BitwiseXorAgg: rename_func("BIT_XOR"),
199
- exp.BitwiseCountAgg: rename_func("BIT_COUNT"),
199
+ exp.BitwiseCount: rename_func("BIT_COUNT"),
200
200
  exp.Create: preprocess(
201
201
  [
202
202
  remove_unique_constraints,
@@ -258,3 +258,11 @@ class Spark(Spark2):
258
258
  return super().placeholder_sql(expression)
259
259
 
260
260
  return f"{{{expression.name}}}"
261
+
262
+ def readparquet_sql(self, expression: exp.ReadParquet) -> str:
263
+ if len(expression.expressions) != 1:
264
+ self.unsupported("READ_PARQUET with multiple arguments is not supported")
265
+ return ""
266
+
267
+ parquet_file = expression.expressions[0]
268
+ return f"parquet.`{parquet_file.name}`"
@@ -127,6 +127,9 @@ class StarRocks(MySQL):
127
127
  PARSE_JSON_NAME: t.Optional[str] = "PARSE_JSON"
128
128
  WITH_PROPERTIES_PREFIX = "PROPERTIES"
129
129
 
130
+ # StarRocks doesn't support "IS TRUE/FALSE" syntax.
131
+ IS_BOOL_ALLOWED = False
132
+
130
133
  CAST_MAPPING = {}
131
134
 
132
135
  TYPE_MAPPING = {
sqlglot/dialects/tsql.py CHANGED
@@ -200,7 +200,7 @@ def _build_hashbytes(args: t.List) -> exp.Expression:
200
200
  return exp.func("HASHBYTES", *args)
201
201
 
202
202
 
203
- DATEPART_ONLY_FORMATS = {"DW", "WK", "HOUR", "QUARTER"}
203
+ DATEPART_ONLY_FORMATS = {"DW", "WK", "HOUR", "QUARTER", "ISO_WEEK"}
204
204
 
205
205
 
206
206
  def _format_sql(self: TSQL.Generator, expression: exp.NumberToStr | exp.TimeToStr) -> str:
@@ -426,6 +426,9 @@ class TSQL(Dialect):
426
426
  "week": "%W",
427
427
  "ww": "%W",
428
428
  "wk": "%W",
429
+ "isowk": "%IW",
430
+ "isoww": "%IW",
431
+ "iso_week": "%IW",
429
432
  "hour": "%h",
430
433
  "hh": "%I",
431
434
  "minute": "%M",
sqlglot/expressions.py CHANGED
@@ -454,9 +454,8 @@ class Expression(metaclass=_Expression):
454
454
  for v in reversed(vs) if reverse else vs: # type: ignore
455
455
  if hasattr(v, "parent"):
456
456
  yield v
457
- else:
458
- if hasattr(vs, "parent"):
459
- yield vs
457
+ elif hasattr(vs, "parent"):
458
+ yield vs
460
459
 
461
460
  def find(self, *expression_types: t.Type[E], bfs: bool = True) -> t.Optional[E]:
462
461
  """
@@ -3834,8 +3833,15 @@ class Update(DML):
3834
3833
  )
3835
3834
 
3836
3835
 
3836
+ # DuckDB supports VALUES followed by https://duckdb.org/docs/stable/sql/query_syntax/limit
3837
3837
  class Values(UDTF):
3838
- arg_types = {"expressions": True, "alias": False}
3838
+ arg_types = {
3839
+ "expressions": True,
3840
+ "alias": False,
3841
+ "order": False,
3842
+ "limit": False,
3843
+ "offset": False,
3844
+ }
3839
3845
 
3840
3846
 
3841
3847
  class Var(Expression):
@@ -5602,7 +5608,7 @@ class BitwiseXorAgg(AggFunc):
5602
5608
  pass
5603
5609
 
5604
5610
 
5605
- class BitwiseCountAgg(AggFunc):
5611
+ class BitwiseCount(Func):
5606
5612
  pass
5607
5613
 
5608
5614
 
@@ -5610,6 +5616,10 @@ class ByteLength(Func):
5610
5616
  pass
5611
5617
 
5612
5618
 
5619
+ class Boolnot(Func):
5620
+ pass
5621
+
5622
+
5613
5623
  # https://cloud.google.com/bigquery/docs/reference/standard-sql/json_functions#bool_for_json
5614
5624
  class JSONBool(Func):
5615
5625
  pass
@@ -6286,6 +6296,10 @@ class LastDay(Func, TimeUnit):
6286
6296
  arg_types = {"this": True, "unit": False}
6287
6297
 
6288
6298
 
6299
+ class PreviousDay(Func):
6300
+ arg_types = {"this": True, "expression": True}
6301
+
6302
+
6289
6303
  class LaxBool(Func):
6290
6304
  pass
6291
6305
 
@@ -6331,6 +6345,10 @@ class TimestampTrunc(Func, TimeUnit):
6331
6345
  arg_types = {"this": True, "unit": True, "zone": False}
6332
6346
 
6333
6347
 
6348
+ class TimeSlice(Func, TimeUnit):
6349
+ arg_types = {"this": True, "expression": True, "unit": True, "kind": False}
6350
+
6351
+
6334
6352
  class TimeAdd(Func, TimeUnit):
6335
6353
  arg_types = {"this": True, "expression": True, "unit": False}
6336
6354
 
@@ -6576,6 +6594,18 @@ class HexEncode(Func):
6576
6594
  arg_types = {"this": True, "case": False}
6577
6595
 
6578
6596
 
6597
+ class Hour(Func):
6598
+ pass
6599
+
6600
+
6601
+ class Minute(Func):
6602
+ pass
6603
+
6604
+
6605
+ class Second(Func):
6606
+ pass
6607
+
6608
+
6579
6609
  # T-SQL: https://learn.microsoft.com/en-us/sql/t-sql/functions/compress-transact-sql?view=sql-server-ver17
6580
6610
  # Snowflake: https://docs.snowflake.com/en/sql-reference/functions/compress
6581
6611
  class Compress(Func):
@@ -6701,7 +6731,7 @@ class FormatJson(Expression):
6701
6731
 
6702
6732
 
6703
6733
  class Format(Func):
6704
- arg_types = {"this": True, "expressions": True}
6734
+ arg_types = {"this": True, "expressions": False}
6705
6735
  is_var_len_args = True
6706
6736
 
6707
6737
 
@@ -7144,6 +7174,10 @@ class Month(Func):
7144
7174
  pass
7145
7175
 
7146
7176
 
7177
+ class Monthname(Func):
7178
+ pass
7179
+
7180
+
7147
7181
  class AddMonths(Func):
7148
7182
  arg_types = {"this": True, "expression": True}
7149
7183
 
@@ -7276,6 +7310,11 @@ class ReadCSV(Func):
7276
7310
  arg_types = {"this": True, "expressions": False}
7277
7311
 
7278
7312
 
7313
+ class ReadParquet(Func):
7314
+ is_var_len_args = True
7315
+ arg_types = {"expressions": True}
7316
+
7317
+
7279
7318
  class Reduce(Func):
7280
7319
  arg_types = {"this": True, "initial": True, "merge": True, "finish": False}
7281
7320
 
@@ -7752,6 +7791,10 @@ class VariancePop(AggFunc):
7752
7791
  _sql_names = ["VARIANCE_POP", "VAR_POP"]
7753
7792
 
7754
7793
 
7794
+ class WidthBucket(Func):
7795
+ arg_types = {"this": True, "min_value": True, "max_value": True, "num_buckets": True}
7796
+
7797
+
7755
7798
  class CovarSamp(Binary, AggFunc):
7756
7799
  pass
7757
7800
 
@@ -7768,6 +7811,10 @@ class WeekStart(Expression):
7768
7811
  pass
7769
7812
 
7770
7813
 
7814
+ class NextDay(Func):
7815
+ arg_types = {"this": True, "expression": True}
7816
+
7817
+
7771
7818
  class XMLElement(Func):
7772
7819
  _sql_names = ["XMLELEMENT"]
7773
7820
  arg_types = {"this": True, "expressions": False}
sqlglot/generator.py CHANGED
@@ -2223,6 +2223,7 @@ class Generator(metaclass=_Generator):
2223
2223
  and (alias or isinstance(expression.parent, (exp.From, exp.Table)))
2224
2224
  else values
2225
2225
  )
2226
+ values = self.query_modifiers(expression, values)
2226
2227
  return f"{values} AS {alias}" if alias else values
2227
2228
 
2228
2229
  # Converts `VALUES...` expression into a series of select unions.
sqlglot/lineage.py CHANGED
@@ -73,6 +73,7 @@ def lineage(
73
73
  dialect: DialectType = None,
74
74
  scope: t.Optional[Scope] = None,
75
75
  trim_selects: bool = True,
76
+ copy: bool = True,
76
77
  **kwargs,
77
78
  ) -> Node:
78
79
  """Build the lineage graph for a column of a SQL query.
@@ -84,21 +85,26 @@ def lineage(
84
85
  sources: A mapping of queries which will be used to continue building lineage.
85
86
  dialect: The dialect of input SQL.
86
87
  scope: A pre-created scope to use instead.
87
- trim_selects: Whether or not to clean up selects by trimming to only relevant columns.
88
+ trim_selects: Whether to clean up selects by trimming to only relevant columns.
89
+ copy: Whether to copy the Expression arguments.
88
90
  **kwargs: Qualification optimizer kwargs.
89
91
 
90
92
  Returns:
91
93
  A lineage node.
92
94
  """
93
95
 
94
- expression = maybe_parse(sql, dialect=dialect)
96
+ expression = maybe_parse(sql, copy=copy, dialect=dialect)
95
97
  column = normalize_identifiers.normalize_identifiers(column, dialect=dialect).name
96
98
 
97
99
  if sources:
98
100
  expression = exp.expand(
99
101
  expression,
100
- {k: t.cast(exp.Query, maybe_parse(v, dialect=dialect)) for k, v in sources.items()},
102
+ {
103
+ k: t.cast(exp.Query, maybe_parse(v, copy=copy, dialect=dialect))
104
+ for k, v in sources.items()
105
+ },
101
106
  dialect=dialect,
107
+ copy=copy,
102
108
  )
103
109
 
104
110
  if not scope:
@@ -280,10 +280,12 @@ def _expand_alias_refs(
280
280
  alias_to_expression: t.Dict[str, t.Tuple[exp.Expression, int]] = {}
281
281
  projections = {s.alias_or_name for s in expression.selects}
282
282
  is_bigquery = dialect == "bigquery"
283
+ replaced = False
283
284
 
284
285
  def replace_columns(
285
286
  node: t.Optional[exp.Expression], resolve_table: bool = False, literal_index: bool = False
286
287
  ) -> None:
288
+ nonlocal replaced
287
289
  is_group_by = isinstance(node, exp.Group)
288
290
  is_having = isinstance(node, exp.Having)
289
291
  if not node or (expand_only_groupby and not is_group_by):
@@ -329,6 +331,7 @@ def _expand_alias_refs(
329
331
  # We should not qualify "id" with "custom_fields" in either clause, since the aggregation shadows the actual table
330
332
  # and we'd get the error: "Column custom_fields contains an aggregation function, which is not allowed in GROUP BY clause"
331
333
  column.replace(exp.to_identifier(column.name))
334
+ replaced = True
332
335
  return
333
336
 
334
337
  if table and (not alias_expr or skip_replace):
@@ -339,7 +342,9 @@ def _expand_alias_refs(
339
342
  ):
340
343
  if literal_index:
341
344
  column.replace(exp.Literal.number(i))
345
+ replaced = True
342
346
  else:
347
+ replaced = True
343
348
  column = column.replace(exp.paren(alias_expr))
344
349
  simplified = simplify_parens(column, dialect)
345
350
  if simplified is not column:
@@ -376,7 +381,8 @@ def _expand_alias_refs(
376
381
  for join in expression.args.get("joins") or []:
377
382
  replace_columns(join)
378
383
 
379
- scope.clear_cache()
384
+ if replaced:
385
+ scope.clear_cache()
380
386
 
381
387
 
382
388
  def _expand_group_by(scope: Scope, dialect: DialectType) -> None:
@@ -270,7 +270,11 @@ def simplify_connectors(expression, root=True):
270
270
  return exp.false()
271
271
  if is_zero(left) or is_zero(right):
272
272
  return exp.false()
273
- if is_null(left) or is_null(right):
273
+ if (
274
+ (is_null(left) and is_null(right))
275
+ or (is_null(left) and always_true(right))
276
+ or (always_true(left) and is_null(right))
277
+ ):
274
278
  return exp.null()
275
279
  if always_true(left) and always_true(right):
276
280
  return exp.true()
@@ -293,9 +297,6 @@ def simplify_connectors(expression, root=True):
293
297
  if is_false(right):
294
298
  return left
295
299
  return _simplify_comparison(expression, left, right, or_=True)
296
- elif isinstance(expression, exp.Xor):
297
- if left == right:
298
- return exp.false()
299
300
 
300
301
  if isinstance(expression, exp.Connector):
301
302
  return _flat_simplify(expression, _simplify_connectors, root)
@@ -1128,7 +1129,7 @@ def remove_where_true(expression):
1128
1129
 
1129
1130
  def always_true(expression):
1130
1131
  return (isinstance(expression, exp.Boolean) and expression.this) or (
1131
- isinstance(expression, exp.Literal) and not is_zero(expression)
1132
+ isinstance(expression, exp.Literal) and expression.is_number and not is_zero(expression)
1132
1133
  )
1133
1134
 
1134
1135
 
sqlglot/parser.py CHANGED
@@ -485,6 +485,7 @@ class Parser(metaclass=_Parser):
485
485
  # Tokens that can represent identifiers
486
486
  ID_VAR_TOKENS = {
487
487
  TokenType.ALL,
488
+ TokenType.ANALYZE,
488
489
  TokenType.ATTACH,
489
490
  TokenType.VAR,
490
491
  TokenType.ANTI,
@@ -1473,7 +1474,7 @@ class Parser(metaclass=_Parser):
1473
1474
 
1474
1475
  RECURSIVE_CTE_SEARCH_KIND = {"BREADTH", "DEPTH", "CYCLE"}
1475
1476
 
1476
- MODIFIABLES = (exp.Query, exp.Table, exp.TableFromRows)
1477
+ MODIFIABLES = (exp.Query, exp.Table, exp.TableFromRows, exp.Values)
1477
1478
 
1478
1479
  STRICT_CAST = True
1479
1480
 
@@ -3225,6 +3226,7 @@ class Parser(metaclass=_Parser):
3225
3226
  this = select
3226
3227
  else:
3227
3228
  this = exp.select("*").from_(t.cast(exp.From, from_))
3229
+ this = self._parse_query_modifiers(self._parse_set_operations(this))
3228
3230
  else:
3229
3231
  this = (
3230
3232
  self._parse_table(consume_pipe=True)
@@ -4624,7 +4626,7 @@ class Parser(metaclass=_Parser):
4624
4626
  return None
4625
4627
 
4626
4628
  return self.expression(
4627
- kind, expressions=[] if with_prefix else self._parse_wrapped_csv(self._parse_column)
4629
+ kind, expressions=[] if with_prefix else self._parse_wrapped_csv(self._parse_bitwise)
4628
4630
  )
4629
4631
 
4630
4632
  def _parse_grouping_sets(self) -> t.Optional[exp.GroupingSets]:
@@ -5814,7 +5816,7 @@ class Parser(metaclass=_Parser):
5814
5816
  this = self.expression(exp.Tuple)
5815
5817
  elif isinstance(this, exp.UNWRAPPED_QUERIES):
5816
5818
  this = self._parse_subquery(this=this, parse_alias=False)
5817
- elif isinstance(this, exp.Subquery):
5819
+ elif isinstance(this, (exp.Subquery, exp.Values)):
5818
5820
  this = self._parse_subquery(
5819
5821
  this=self._parse_query_modifiers(self._parse_set_operations(this)),
5820
5822
  parse_alias=False,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlglot
3
- Version: 27.27.0
3
+ Version: 27.28.1
4
4
  Summary: An easily customizable SQL parser and transpiler
5
5
  Author-email: Toby Mao <toby.mao@gmail.com>
6
6
  License-Expression: MIT
@@ -1,15 +1,15 @@
1
1
  sqlglot/__init__.py,sha256=za08rtdPh2v7dOpGdNomttlIVGgTrKja7rPd6sQwaTg,5391
2
2
  sqlglot/__main__.py,sha256=022c173KqxsiABWTEpUIq_tJUxuNiW7a7ABsxBXqvu8,2069
3
3
  sqlglot/_typing.py,sha256=-1HPyr3w5COlSJWqlgt8jhFk2dyMvBuvVBqIX1wyVCM,642
4
- sqlglot/_version.py,sha256=DcL6qrG2tT7X1MpfROtPMQ08iOdQQhq3jUOUDiSxmm0,708
4
+ sqlglot/_version.py,sha256=a2s3xivaD0dEK5-MT3OUAmpTCsjQgqde6-5KQyvtpi8,708
5
5
  sqlglot/diff.py,sha256=PtOllQMQa1Sw1-V2Y8eypmDqGujXYPaTOp_WLsWkAWk,17314
6
6
  sqlglot/errors.py,sha256=QNKMr-pzLUDR-tuMmn_GK6iMHUIVdb_YSJ_BhGEvuso,2126
7
- sqlglot/expressions.py,sha256=uon9D-UuY81594xYDRkxsCa5vUsLdzJhdNmxDEnMOwc,261799
8
- sqlglot/generator.py,sha256=aXMzVK4vDjlUQg8i55BtOEgIfGIIa2C4An7NAY-TVQ8,227272
7
+ sqlglot/expressions.py,sha256=IzTuOpj16YU8hqkpa82JSfhcQ_05DR8ER9agQYexFT8,262590
8
+ sqlglot/generator.py,sha256=R6AmMoZAOQZS5r1odOcMbulJHNGArSCEgFgE48AtaAo,227334
9
9
  sqlglot/helper.py,sha256=OOt5_Mbmnl4Uy6WO6v7DR1iLPcb3v6ITybpq6usf3jw,14471
10
10
  sqlglot/jsonpath.py,sha256=SQgaxzaEYBN7At9dkTK4N1Spk6xHxvHL6QtCIP6iM30,7905
11
- sqlglot/lineage.py,sha256=Qj5ykuDNcATppb9vOjoIKBqRVLbu3OMPiZk9f3iyv40,15312
12
- sqlglot/parser.py,sha256=fiY6bFbbU8fR4fu4oXcQwZWptTvRD30unXmDCZzs7DE,338623
11
+ sqlglot/lineage.py,sha256=f3yT6sZzY2Plbo49Il8pfmGWuzRgKpSiORaEO4wUXsI,15475
12
+ sqlglot/parser.py,sha256=RwvK9nX5vVU2nz8cFTBSvJ56kap8JzJ7aX7zqupfls4,338762
13
13
  sqlglot/planner.py,sha256=ql7Li-bWJRcyXzNaZy_n6bQ6B2ZfunEIB8Ztv2xaxq4,14634
14
14
  sqlglot/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  sqlglot/schema.py,sha256=13H2qKQs27EKdTpDLOvcNnSTDAUbYNKjWtJs4aQCSOA,20509
@@ -20,21 +20,21 @@ sqlglot/transforms.py,sha256=14RbNbPBL3O4vOQPEbQlBTizK8L-Y85Lj47iguW8ucc,40165
20
20
  sqlglot/trie.py,sha256=v27uXMrHfqrXlJ6GmeTSMovsB_3o0ctnlKhdNt7W6fI,2245
21
21
  sqlglot/dialects/__init__.py,sha256=g3HRtyb32r3LooiHKTzuUNB0_rBO_RauuOegp42gB48,3811
22
22
  sqlglot/dialects/athena.py,sha256=ofArmayYLev4qZQ15GM8mevG04qqR5WGFb2ZcuYm6x4,10966
23
- sqlglot/dialects/bigquery.py,sha256=l_t70png3A83zEDWUBBsCbiM40HfKIP03Wuq3Zt9CUI,72889
24
- sqlglot/dialects/clickhouse.py,sha256=CTmBJRGVPm4EEy4mhz4nLUfPcqyQWvkyBjWn6pxAVfo,58646
23
+ sqlglot/dialects/bigquery.py,sha256=7RCx2S9NBBCREE6crIa_zHMHtf4QoVRxe2KjJf5FvZE,68631
24
+ sqlglot/dialects/clickhouse.py,sha256=bV9wlcaKC020up7WYz2Me0eti_hYxHq4GzLbAdbyOYY,58750
25
25
  sqlglot/dialects/databricks.py,sha256=H4QTq7gg6tJylKc_YWsGp6049KydoI_wlQUHM7iCJtI,4753
26
26
  sqlglot/dialects/dialect.py,sha256=2ReSGrvsJvZF0SnpZp-NFkcHqaiEPsRQEK4IvAGLqCk,74022
27
27
  sqlglot/dialects/doris.py,sha256=CFnF955Oav3IjZWA80ickOI8tPpCjxk7BN5R4Z6pA1U,25263
28
28
  sqlglot/dialects/dremio.py,sha256=nOMxu_4xVKSOmMGNSwdxXSPc243cNbbpb-xXzYdgdeg,8460
29
29
  sqlglot/dialects/drill.py,sha256=FOh7_KjPx_77pv0DiHKZog0CcmzqeF9_PEmGnJ1ESSM,5825
30
30
  sqlglot/dialects/druid.py,sha256=kh3snZtneehNOWqs3XcPjsrhNaRbkCQ8E4hHbWJ1fHM,690
31
- sqlglot/dialects/duckdb.py,sha256=aOQ4gVhWIgC5mnoO-e-ibNvmpZfS3_S0_8FZye-j3aA,55157
31
+ sqlglot/dialects/duckdb.py,sha256=Hg-j3_AXJQ9WgrDQGT0WDR31N7Yag2aDK3wtuG3wf44,55825
32
32
  sqlglot/dialects/dune.py,sha256=gALut-fFfN2qMsr8LvZ1NQK3F3W9z2f4PwMvTMXVVVg,375
33
33
  sqlglot/dialects/exasol.py,sha256=ay3g_VyT5WvHTgNyJuCQu0nBt4bpllLZ9IdMBizEgYM,15761
34
34
  sqlglot/dialects/fabric.py,sha256=BdkvzM8s-m5DIdBwdjEYskp32ub7aHCAex_xlhQn92I,10222
35
35
  sqlglot/dialects/hive.py,sha256=Uw-7Y1LnYOdcv71jCIZXhMvJAWwU5AVcFlIuM-YArnY,34530
36
36
  sqlglot/dialects/materialize.py,sha256=LD2q1kTRrCwkIu1BfoBvnjTGbupDtoQ8JQMDCIYAXHg,3533
37
- sqlglot/dialects/mysql.py,sha256=xxVAR-pXMljYCUioavP3nROtOqKmK4kfdp4WWXX7X9g,50049
37
+ sqlglot/dialects/mysql.py,sha256=nDwO8xERj0FD33qZMZcesEot6hbaifYQCnCUEpo5T0w,50043
38
38
  sqlglot/dialects/oracle.py,sha256=qB6Ga0Si2-TpVNqU_2COvWESIUYNL32rYk_BC9aiujE,15898
39
39
  sqlglot/dialects/postgres.py,sha256=DBnVQKXs8ZEapDB_fcM9k73dZO01byOWmbcReAIPwAw,34851
40
40
  sqlglot/dialects/presto.py,sha256=5C6I_aDC-9CDrLfY97EFsUWymaS3B7aW_-h-mHleWIQ,33339
@@ -42,16 +42,16 @@ sqlglot/dialects/prql.py,sha256=fwN-SPEGx-drwf1K0U2MByN-PkW3C_rOgQ3xeJeychg,7908
42
42
  sqlglot/dialects/redshift.py,sha256=FIwtP3yEg-way9pa32kxCJc6IaFkHVIvgYKZA-Ilmi0,15919
43
43
  sqlglot/dialects/risingwave.py,sha256=Wd-I_Hbwl-6Rgf_NM0I_axliInY418k2kaAWRCmaqyE,3791
44
44
  sqlglot/dialects/singlestore.py,sha256=0QqNYOucNklPQuyeGcsisLI97qPGx_RfWKOFarJz2qw,61711
45
- sqlglot/dialects/snowflake.py,sha256=Ll13pf9n_P5b5ied2gDaci_g-dqoyoq9Po7T2hEKzZg,82277
45
+ sqlglot/dialects/snowflake.py,sha256=Mag5lU0Rx4ffXkIMrcwgw3fh3HrXaKHOunRZ9x4dkU0,84070
46
46
  sqlglot/dialects/solr.py,sha256=pydnl4ml-3M1Fc4ALm6cMVO9h-5EtqZxPZH_91Nz1Ss,617
47
- sqlglot/dialects/spark.py,sha256=mt3Twh0_EJelYy_7HLinDEQ1Chj2EYMjeLCPLRzAJXY,10113
47
+ sqlglot/dialects/spark.py,sha256=j83lEzkAWbw8LTkk1vxXrYA3d5pmcg8Ze8Xws001g7s,10450
48
48
  sqlglot/dialects/spark2.py,sha256=s4RTOGunYT1_HJt4KbhBWK_eOgmtzlpBCQCl60KEPAQ,15621
49
49
  sqlglot/dialects/sqlite.py,sha256=FuEDDyKZeeWVblknhFSMX7dNoS-ci5ktXpSXZeBK5xA,13592
50
- sqlglot/dialects/starrocks.py,sha256=-NWQa2gJbiMMfLauX-Jy9ciJ5DUzUOk2QkPbhglz5W4,11446
50
+ sqlglot/dialects/starrocks.py,sha256=iTnVIKwjaInc_iOs21BFf7-5HEhjVodXBMmIOhMwVvo,11539
51
51
  sqlglot/dialects/tableau.py,sha256=oIawDzUITxGCWaEMB8OaNMPWhbC3U-2y09pYPm4eazc,2190
52
52
  sqlglot/dialects/teradata.py,sha256=7LxCcRwP0Idd_OnCzA57NCdheVjHcKC2aFAKG5N49IU,18202
53
53
  sqlglot/dialects/trino.py,sha256=Z7prRhCxIBh0KCxIQpWmVOIGHCJM9Xl5oRlqySxln4Y,4350
54
- sqlglot/dialects/tsql.py,sha256=oRyxKLpUzdb2dmoWtTkxrM1my2uEJGoxR89l_IFpzww,54948
54
+ sqlglot/dialects/tsql.py,sha256=P3G2P6UY77x4xakwCoppO4MD-GZIaxsqu8RhMotNdn4,55035
55
55
  sqlglot/executor/__init__.py,sha256=FslewzYQtQdDNg_0Ju2UaiP4vo4IMUgkfkmFsYUhcN0,2958
56
56
  sqlglot/executor/context.py,sha256=WJHJdYQCOeVXwLw0uSSrWSc25eBMn5Ix108RCvdsKRQ,3386
57
57
  sqlglot/executor/env.py,sha256=tQhU5PpTBMcxgZIFddFqxWMNPtHN0vOOz72voncY3KY,8276
@@ -72,13 +72,13 @@ sqlglot/optimizer/optimizer.py,sha256=vXEXDWHvbO-vJmSI7UqJuydM2WrD1xko7rETq2EtVJ
72
72
  sqlglot/optimizer/pushdown_predicates.py,sha256=HGjs3Z4V3-X2d1VTfWhyByY3aL5SmKnVvt3aDXiiBM0,8414
73
73
  sqlglot/optimizer/pushdown_projections.py,sha256=7NoK5NAUVYVhs0YnYyo6WuXfaO-BShSwS6lA8Y-ATQ4,6668
74
74
  sqlglot/optimizer/qualify.py,sha256=oAPfwub7dEkrlCrsptcJWpLya4BgKhN6M5SwIs_86LY,4002
75
- sqlglot/optimizer/qualify_columns.py,sha256=JPVASnK4X0HOGtr6fEhUsd-94yFiJdCSO-H6zx1n4UA,45294
75
+ sqlglot/optimizer/qualify_columns.py,sha256=yTEZ4_GBt0ml3g0xQNGu759m_gR3meF2geKEENCP1mc,45474
76
76
  sqlglot/optimizer/qualify_tables.py,sha256=asv18k_PXAett6xhCyjCBH4EycZk4WYSnNFLqoFfVQw,6687
77
77
  sqlglot/optimizer/scope.py,sha256=UOTrbwqcTc5iRQf0WStgYWXpE24w6riZy-tJYA18yTw,31229
78
- sqlglot/optimizer/simplify.py,sha256=27IYsqbz1kyMlURSfRkm_ADSQJg-4805AOMFOjKKytU,51049
78
+ sqlglot/optimizer/simplify.py,sha256=TzbIh0XK0M92ZnCLtI4GI6UUX2eXqB-wQHizqGmX84E,51114
79
79
  sqlglot/optimizer/unnest_subqueries.py,sha256=zt5UFYGAfDBTDPbJCpzm4HbXDDia5GlyKZd3SdBXYEk,10906
80
- sqlglot-27.27.0.dist-info/licenses/LICENSE,sha256=p1Yk0B4oa0l8Rh-_dYyy75d8spjPd_vTloXfz4FWxys,1065
81
- sqlglot-27.27.0.dist-info/METADATA,sha256=nnaX1EICQuz87cROcK2_MHDB99y9dhtT--92vbUnrqQ,20825
82
- sqlglot-27.27.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
83
- sqlglot-27.27.0.dist-info/top_level.txt,sha256=5kRskCGA_gVADF9rSfSzPdLHXqvfMusDYeHePfNY2nQ,8
84
- sqlglot-27.27.0.dist-info/RECORD,,
80
+ sqlglot-27.28.1.dist-info/licenses/LICENSE,sha256=p1Yk0B4oa0l8Rh-_dYyy75d8spjPd_vTloXfz4FWxys,1065
81
+ sqlglot-27.28.1.dist-info/METADATA,sha256=e2Z2QQhb-a4xkhBzGcaTVSd2CUIynP-OUv-UcazYFeg,20825
82
+ sqlglot-27.28.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
83
+ sqlglot-27.28.1.dist-info/top_level.txt,sha256=5kRskCGA_gVADF9rSfSzPdLHXqvfMusDYeHePfNY2nQ,8
84
+ sqlglot-27.28.1.dist-info/RECORD,,