1
0
Fork 0

Merging upstream version 10.5.10.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-13 15:07:05 +01:00
parent 8588db6332
commit 4d496b7a6a
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
43 changed files with 1384 additions and 356 deletions

View file

@ -1,5 +1,6 @@
"""
.. include:: ../posts/sql_diff.md
----
"""
from __future__ import annotations
@ -75,12 +76,13 @@ def diff(source: exp.Expression, target: exp.Expression) -> t.List[Edit]:
]
Args:
source (sqlglot.Expression): the source expression.
target (sqlglot.Expression): the target expression against which the diff should be calculated.
source: the source expression.
target: the target expression against which the diff should be calculated.
Returns:
the list of Insert, Remove, Move, Update and Keep objects for each node in the source and the target expression trees.
This list represents a sequence of steps needed to transform the source expression tree into the target one.
the list of Insert, Remove, Move, Update and Keep objects for each node in the source and the
target expression trees. This list represents a sequence of steps needed to transform the source
expression tree into the target one.
"""
return ChangeDistiller().diff(source.copy(), target.copy())
@ -258,7 +260,7 @@ class ChangeDistiller:
return bigram_histo
def _get_leaves(expression: exp.Expression) -> t.Generator[exp.Expression, None, None]:
def _get_leaves(expression: exp.Expression) -> t.Iterator[exp.Expression]:
has_child_exprs = False
for a in expression.args.values():