Adding upstream version 25.30.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
c61927f460
commit
44a4f87ffd
69 changed files with 48139 additions and 46098 deletions
|
@ -767,6 +767,7 @@ class Expression(metaclass=_Expression):
|
|||
*expressions: t.Optional[ExpOrStr],
|
||||
dialect: DialectType = None,
|
||||
copy: bool = True,
|
||||
wrap: bool = True,
|
||||
**opts,
|
||||
) -> Condition:
|
||||
"""
|
||||
|
@ -781,18 +782,22 @@ class Expression(metaclass=_Expression):
|
|||
If an `Expression` instance is passed, it will be used as-is.
|
||||
dialect: the dialect used to parse the input expression.
|
||||
copy: whether to copy the involved expressions (only applies to Expressions).
|
||||
wrap: whether to wrap the operands in `Paren`s. This is true by default to avoid
|
||||
precedence issues, but can be turned off when the produced AST is too deep and
|
||||
causes recursion-related issues.
|
||||
opts: other options to use to parse the input expressions.
|
||||
|
||||
Returns:
|
||||
The new And condition.
|
||||
"""
|
||||
return and_(self, *expressions, dialect=dialect, copy=copy, **opts)
|
||||
return and_(self, *expressions, dialect=dialect, copy=copy, wrap=wrap, **opts)
|
||||
|
||||
def or_(
|
||||
self,
|
||||
*expressions: t.Optional[ExpOrStr],
|
||||
dialect: DialectType = None,
|
||||
copy: bool = True,
|
||||
wrap: bool = True,
|
||||
**opts,
|
||||
) -> Condition:
|
||||
"""
|
||||
|
@ -807,12 +812,15 @@ class Expression(metaclass=_Expression):
|
|||
If an `Expression` instance is passed, it will be used as-is.
|
||||
dialect: the dialect used to parse the input expression.
|
||||
copy: whether to copy the involved expressions (only applies to Expressions).
|
||||
wrap: whether to wrap the operands in `Paren`s. This is true by default to avoid
|
||||
precedence issues, but can be turned off when the produced AST is too deep and
|
||||
causes recursion-related issues.
|
||||
opts: other options to use to parse the input expressions.
|
||||
|
||||
Returns:
|
||||
The new Or condition.
|
||||
"""
|
||||
return or_(self, *expressions, dialect=dialect, copy=copy, **opts)
|
||||
return or_(self, *expressions, dialect=dialect, copy=copy, wrap=wrap, **opts)
|
||||
|
||||
def not_(self, copy: bool = True):
|
||||
"""
|
||||
|
@ -5939,6 +5947,10 @@ class JSONValue(Expression):
|
|||
}
|
||||
|
||||
|
||||
class JSONValueArray(Func):
|
||||
arg_types = {"this": True, "expression": False}
|
||||
|
||||
|
||||
# # https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/JSON_TABLE.html
|
||||
class JSONTable(Func):
|
||||
arg_types = {
|
||||
|
@ -5995,6 +6007,10 @@ class JSONExtract(Binary, Func):
|
|||
return self.expression.output_name if not self.expressions else ""
|
||||
|
||||
|
||||
class JSONExtractArray(Func):
|
||||
arg_types = {"this": True, "expression": False}
|
||||
|
||||
|
||||
class JSONExtractScalar(Binary, Func):
|
||||
arg_types = {"this": True, "expression": True, "only_json_types": False, "expressions": False}
|
||||
_sql_names = ["JSON_EXTRACT_SCALAR"]
|
||||
|
@ -6233,11 +6249,22 @@ class Reduce(Func):
|
|||
class RegexpExtract(Func):
|
||||
arg_types = {
|
||||
"this": True,
|
||||
"expression": True, # The pattern
|
||||
"position": False, # Only start searching the string from this index
|
||||
"occurrence": False, # Skip the first `occurence-1` matches
|
||||
"parameters": False, # Flags, eg "i" for case-insensitive
|
||||
"group": False, # Which group to return
|
||||
"expression": True,
|
||||
"position": False,
|
||||
"occurrence": False,
|
||||
"parameters": False,
|
||||
"group": False,
|
||||
}
|
||||
|
||||
|
||||
class RegexpExtractAll(Func):
|
||||
arg_types = {
|
||||
"this": True,
|
||||
"expression": True,
|
||||
"position": False,
|
||||
"occurrence": False,
|
||||
"parameters": False,
|
||||
"group": False,
|
||||
}
|
||||
|
||||
|
||||
|
@ -6516,6 +6543,10 @@ class UnixToTimeStr(Func):
|
|||
pass
|
||||
|
||||
|
||||
class UnixSeconds(Func):
|
||||
pass
|
||||
|
||||
|
||||
class Uuid(Func):
|
||||
_sql_names = ["UUID", "GEN_RANDOM_UUID", "GENERATE_UUID", "UUID_STRING"]
|
||||
|
||||
|
@ -6898,6 +6929,7 @@ def _combine(
|
|||
operator: t.Type[Connector],
|
||||
dialect: DialectType = None,
|
||||
copy: bool = True,
|
||||
wrap: bool = True,
|
||||
**opts,
|
||||
) -> Expression:
|
||||
conditions = [
|
||||
|
@ -6907,10 +6939,10 @@ def _combine(
|
|||
]
|
||||
|
||||
this, *rest = conditions
|
||||
if rest:
|
||||
if rest and wrap:
|
||||
this = _wrap(this, Connector)
|
||||
for expression in rest:
|
||||
this = operator(this=this, expression=_wrap(expression, Connector))
|
||||
this = operator(this=this, expression=_wrap(expression, Connector) if wrap else expression)
|
||||
|
||||
return this
|
||||
|
||||
|
@ -7293,7 +7325,11 @@ def condition(
|
|||
|
||||
|
||||
def and_(
|
||||
*expressions: t.Optional[ExpOrStr], dialect: DialectType = None, copy: bool = True, **opts
|
||||
*expressions: t.Optional[ExpOrStr],
|
||||
dialect: DialectType = None,
|
||||
copy: bool = True,
|
||||
wrap: bool = True,
|
||||
**opts,
|
||||
) -> Condition:
|
||||
"""
|
||||
Combine multiple conditions with an AND logical operator.
|
||||
|
@ -7307,16 +7343,23 @@ def and_(
|
|||
If an Expression instance is passed, this is used as-is.
|
||||
dialect: the dialect used to parse the input expression.
|
||||
copy: whether to copy `expressions` (only applies to Expressions).
|
||||
wrap: whether to wrap the operands in `Paren`s. This is true by default to avoid
|
||||
precedence issues, but can be turned off when the produced AST is too deep and
|
||||
causes recursion-related issues.
|
||||
**opts: other options to use to parse the input expressions.
|
||||
|
||||
Returns:
|
||||
The new condition
|
||||
"""
|
||||
return t.cast(Condition, _combine(expressions, And, dialect, copy=copy, **opts))
|
||||
return t.cast(Condition, _combine(expressions, And, dialect, copy=copy, wrap=wrap, **opts))
|
||||
|
||||
|
||||
def or_(
|
||||
*expressions: t.Optional[ExpOrStr], dialect: DialectType = None, copy: bool = True, **opts
|
||||
*expressions: t.Optional[ExpOrStr],
|
||||
dialect: DialectType = None,
|
||||
copy: bool = True,
|
||||
wrap: bool = True,
|
||||
**opts,
|
||||
) -> Condition:
|
||||
"""
|
||||
Combine multiple conditions with an OR logical operator.
|
||||
|
@ -7330,16 +7373,23 @@ def or_(
|
|||
If an Expression instance is passed, this is used as-is.
|
||||
dialect: the dialect used to parse the input expression.
|
||||
copy: whether to copy `expressions` (only applies to Expressions).
|
||||
wrap: whether to wrap the operands in `Paren`s. This is true by default to avoid
|
||||
precedence issues, but can be turned off when the produced AST is too deep and
|
||||
causes recursion-related issues.
|
||||
**opts: other options to use to parse the input expressions.
|
||||
|
||||
Returns:
|
||||
The new condition
|
||||
"""
|
||||
return t.cast(Condition, _combine(expressions, Or, dialect, copy=copy, **opts))
|
||||
return t.cast(Condition, _combine(expressions, Or, dialect, copy=copy, wrap=wrap, **opts))
|
||||
|
||||
|
||||
def xor(
|
||||
*expressions: t.Optional[ExpOrStr], dialect: DialectType = None, copy: bool = True, **opts
|
||||
*expressions: t.Optional[ExpOrStr],
|
||||
dialect: DialectType = None,
|
||||
copy: bool = True,
|
||||
wrap: bool = True,
|
||||
**opts,
|
||||
) -> Condition:
|
||||
"""
|
||||
Combine multiple conditions with an XOR logical operator.
|
||||
|
@ -7353,12 +7403,15 @@ def xor(
|
|||
If an Expression instance is passed, this is used as-is.
|
||||
dialect: the dialect used to parse the input expression.
|
||||
copy: whether to copy `expressions` (only applies to Expressions).
|
||||
wrap: whether to wrap the operands in `Paren`s. This is true by default to avoid
|
||||
precedence issues, but can be turned off when the produced AST is too deep and
|
||||
causes recursion-related issues.
|
||||
**opts: other options to use to parse the input expressions.
|
||||
|
||||
Returns:
|
||||
The new condition
|
||||
"""
|
||||
return t.cast(Condition, _combine(expressions, Xor, dialect, copy=copy, **opts))
|
||||
return t.cast(Condition, _combine(expressions, Xor, dialect, copy=copy, wrap=wrap, **opts))
|
||||
|
||||
|
||||
def not_(expression: ExpOrStr, dialect: DialectType = None, copy: bool = True, **opts) -> Not:
|
||||
|
@ -8052,7 +8105,7 @@ def table_name(table: Table | str, dialect: DialectType = None, identify: bool =
|
|||
|
||||
return ".".join(
|
||||
(
|
||||
part.sql(dialect=dialect, identify=True, copy=False)
|
||||
part.sql(dialect=dialect, identify=True, copy=False, comments=False)
|
||||
if identify or not SAFE_IDENTIFIER_RE.match(part.name)
|
||||
else part.name
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue