Merging upstream version 9.0.6.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
e369f04a93
commit
69b4fb4368
31 changed files with 694 additions and 196 deletions
|
@ -28,6 +28,7 @@ class Dialects(str, Enum):
|
|||
TABLEAU = "tableau"
|
||||
TRINO = "trino"
|
||||
TSQL = "tsql"
|
||||
DATABRICKS = "databricks"
|
||||
|
||||
|
||||
class _Dialect(type):
|
||||
|
@ -331,3 +332,15 @@ def create_with_partitions_sql(self, expression):
|
|||
expression.set("this", schema)
|
||||
|
||||
return self.create_sql(expression)
|
||||
|
||||
|
||||
def parse_date_delta(exp_class, unit_mapping=None):
|
||||
def inner_func(args):
|
||||
unit_based = len(args) == 3
|
||||
this = list_get(args, 2) if unit_based else list_get(args, 0)
|
||||
expression = list_get(args, 1) if unit_based else list_get(args, 1)
|
||||
unit = list_get(args, 0) if unit_based else exp.Literal.string("DAY")
|
||||
unit = unit_mapping.get(unit.name.lower(), unit) if unit_mapping else unit
|
||||
return exp_class(this=this, expression=expression, unit=unit)
|
||||
|
||||
return inner_func
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue