1
0
Fork 0

Adding upstream version 26.16.4.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-05-04 09:27:39 +02:00
parent 6e767a6f98
commit 4362133ee5
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
57 changed files with 54950 additions and 53265 deletions

View file

@ -64,6 +64,7 @@ SQLGLOT_META = "sqlglot.meta"
SQLGLOT_ANONYMOUS = "sqlglot.anonymous"
TABLE_PARTS = ("this", "db", "catalog")
COLUMN_PARTS = ("this", "table", "db", "catalog")
POSITION_META_KEYS = ("line", "col", "start", "end")
class Expression(metaclass=_Expression):
@ -846,6 +847,32 @@ class Expression(metaclass=_Expression):
"""
return not_(self, copy=copy)
def update_positions(
self: E, other: t.Optional[Token | Expression] = None, **kwargs: t.Any
) -> E:
"""
Update this expression with positions from a token or other expression.
Args:
other: a token or expression to update this expression with.
Returns:
The updated expression.
"""
if isinstance(other, Expression):
self.meta.update({k: v for k, v in other.meta.items() if k in POSITION_META_KEYS})
elif other is not None:
self.meta.update(
{
"line": other.line,
"col": other.col,
"start": other.start,
"end": other.end,
}
)
self.meta.update({k: v for k, v in kwargs.items() if k in POSITION_META_KEYS})
return self
def as_(
self,
alias: str | Identifier,
@ -3307,6 +3334,11 @@ class Put(Expression):
arg_types = {"this": True, "target": True, "properties": False}
# https://docs.snowflake.com/en/sql-reference/sql/get
class Get(Expression):
arg_types = {"this": True, "target": True, "properties": False}
class Table(Expression):
arg_types = {
"this": False,