sql-code-graph 1.35.0__py3-none-any.whl → 1.35.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.
- {sql_code_graph-1.35.0.dist-info → sql_code_graph-1.35.1.dist-info}/METADATA +1 -1
- {sql_code_graph-1.35.0.dist-info → sql_code_graph-1.35.1.dist-info}/RECORD +6 -6
- sqlcg/__init__.py +1 -1
- sqlcg/parsers/ansi_parser.py +35 -16
- {sql_code_graph-1.35.0.dist-info → sql_code_graph-1.35.1.dist-info}/WHEEL +0 -0
- {sql_code_graph-1.35.0.dist-info → sql_code_graph-1.35.1.dist-info}/entry_points.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sql-code-graph
|
|
3
|
-
Version: 1.35.
|
|
3
|
+
Version: 1.35.1
|
|
4
4
|
Summary: SQL code graph analyzer and lineage tracer
|
|
5
5
|
Project-URL: Homepage, https://github.com/Warhorze/sql-code-graph
|
|
6
6
|
Project-URL: Repository, https://github.com/Warhorze/sql-code-graph
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
sqlcg/__init__.py,sha256=
|
|
1
|
+
sqlcg/__init__.py,sha256=VahDFz44BfVysbx4bUBilcYdqMPT5hNDCMqoIkgonw0,116
|
|
2
2
|
sqlcg/__main__.py,sha256=1YoFLcqEgTwYq1J3TbUwpkdG0zeeLIf2fJvwWI-CLFU,109
|
|
3
3
|
sqlcg/cli/__init__.py,sha256=W8fD0LpMq2xm_5WKGNMvJh2WBL1ho5E8hUeAqXQYT1g,28
|
|
4
4
|
sqlcg/cli/coverage.py,sha256=Xm9ITzZDHv2mJ70Q5jCacVuhDStVrE3gq12_-Ypvtd8,43823
|
|
@@ -44,7 +44,7 @@ sqlcg/lineage/schema_resolver.py,sha256=iXt6LYF6UVWsGUpcfbmjmGn9wCgXl721lTGf_8Aa
|
|
|
44
44
|
sqlcg/metrics/__init__.py,sha256=hLJ6wm4St8qqYwKh3o9QG7lcEt1BEYM31ccqO9tGpIg,133
|
|
45
45
|
sqlcg/metrics/store.py,sha256=KuDtxvyAgug9_KtiSCpvgKM2VZM7VSaI3D11uMLjJJk,10604
|
|
46
46
|
sqlcg/parsers/__init__.py,sha256=AamA8wBbDZV9_zEtZCI4Hyen5UAVKHmBwjTghTt2PZE,785
|
|
47
|
-
sqlcg/parsers/ansi_parser.py,sha256=
|
|
47
|
+
sqlcg/parsers/ansi_parser.py,sha256=RX6eVj7gt1qmsHNJLAF_a4jyW3RCI5W2oF4rd53cKNg,39336
|
|
48
48
|
sqlcg/parsers/base.py,sha256=Q2X_qN7DmGFU2oA6Z9fcxyjpkeb6lOsia4BcwPvwNLo,97806
|
|
49
49
|
sqlcg/parsers/bigquery_parser.py,sha256=mOnWTfXB_Dp4JwFE1PVYOB6CDPf5nYE0Dea8kJCl9uQ,2827
|
|
50
50
|
sqlcg/parsers/postgres_parser.py,sha256=lYfUpQY6j4Qm7ndXBtXbgPoGzYqYddWt5YeFnWKdA6I,946
|
|
@@ -72,7 +72,7 @@ sqlcg/viz/render.py,sha256=BINkGbJbbb_iqhrkN795RaQsdg8nqCiJtsEFF1yo22Y,2737
|
|
|
72
72
|
sqlcg/viz/tags.py,sha256=6zRnGlHjuGmEeB6yN1uhzm8rqL7ZGoyL1Ki7jI5oM6A,5368
|
|
73
73
|
sqlcg/viz/assets/force-graph.min.js,sha256=jNdYdDdrYiUdUlElxRkolPBt30rstQk2q15Q32VVdzc,177272
|
|
74
74
|
sqlcg/viz/assets/template.html,sha256=9_j-mvo1ZxwgiJPDdVrNmca37dTrTjjYVd3977u-DxE,12294
|
|
75
|
-
sql_code_graph-1.35.
|
|
76
|
-
sql_code_graph-1.35.
|
|
77
|
-
sql_code_graph-1.35.
|
|
78
|
-
sql_code_graph-1.35.
|
|
75
|
+
sql_code_graph-1.35.1.dist-info/METADATA,sha256=YOc2OzDrdadgZdpmY3QhwueUwScKj39svzKO4dgd9Q0,17791
|
|
76
|
+
sql_code_graph-1.35.1.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
|
|
77
|
+
sql_code_graph-1.35.1.dist-info/entry_points.txt,sha256=Wfe49sVzV9p4eVFGo5RxcV-frr3HOP0yzzst8JBxQLQ,46
|
|
78
|
+
sql_code_graph-1.35.1.dist-info/RECORD,,
|
sqlcg/__init__.py
CHANGED
sqlcg/parsers/ansi_parser.py
CHANGED
|
@@ -551,25 +551,44 @@ class AnsiParser(SqlParser):
|
|
|
551
551
|
# measurement artifact (96.1%/4,544 of 4,727 on the DWH corpus).
|
|
552
552
|
can_have_lineage = self._can_have_column_lineage(stmt)
|
|
553
553
|
|
|
554
|
+
# Phantom source-node gate (#161): a non-table/non-view CREATE
|
|
555
|
+
# (SEQUENCE / STAGE / FILE FORMAT / SCHEMA / INDEX / PROCEDURE / ...) has
|
|
556
|
+
# target=None and no data-flow source. Its only Table node is its own
|
|
557
|
+
# object name, which _fallback_table_scan below would otherwise scoop into
|
|
558
|
+
# `sources`, leaking a phantom SqlTable SOURCE node + SELECTS_FROM edge
|
|
559
|
+
# into the graph. #159 fixed the kind LABEL (-> OTHER); this closes the
|
|
560
|
+
# source-node half. Keying off stmt.kind (the sqlglot AST value, e.g.
|
|
561
|
+
# 'SEQUENCE') keeps the gate independent of the _classify/QueryKind path.
|
|
562
|
+
# CREATE TABLE/VIEW ... AS SELECT keep kind in (TABLE, VIEW) and so retain
|
|
563
|
+
# their real sources. Real procedure lineage comes from the spliced inner
|
|
564
|
+
# DML (a separate node the gate never touches), so gating PROCEDURE is
|
|
565
|
+
# edge-neutral. This single gate feeds all three
|
|
566
|
+
# `referenced_tables.extend(query_node.sources)` sites
|
|
567
|
+
# (ansi_parser.py:246, snowflake_parser.py:784 / :944).
|
|
568
|
+
is_non_table_create = isinstance(stmt, exp.Create) and stmt.kind not in ("TABLE", "VIEW")
|
|
569
|
+
|
|
554
570
|
# Try to extract table references using scope analysis
|
|
555
571
|
try:
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
if root_scope is None:
|
|
559
|
-
from sqlglot.optimizer.scope import build_scope
|
|
560
|
-
|
|
561
|
-
root_scope = build_scope(stmt)
|
|
562
|
-
|
|
563
|
-
if root_scope:
|
|
564
|
-
sources = self._real_tables(root_scope)
|
|
572
|
+
if is_non_table_create:
|
|
573
|
+
sources = []
|
|
565
574
|
else:
|
|
566
|
-
#
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
575
|
+
# Use pre-built scope if provided, otherwise build it here (fallback)
|
|
576
|
+
root_scope = scope
|
|
577
|
+
if root_scope is None:
|
|
578
|
+
from sqlglot.optimizer.scope import build_scope
|
|
579
|
+
|
|
580
|
+
root_scope = build_scope(stmt)
|
|
581
|
+
|
|
582
|
+
if root_scope:
|
|
583
|
+
sources = self._real_tables(root_scope)
|
|
584
|
+
else:
|
|
585
|
+
# Fallback to basic table extraction
|
|
586
|
+
sources = [
|
|
587
|
+
r
|
|
588
|
+
for s in self._fallback_table_scan(stmt)
|
|
589
|
+
if (r := self._apply_table_alias(s)) is not None
|
|
590
|
+
]
|
|
591
|
+
parse_failed = can_have_lineage
|
|
573
592
|
except Exception as exc:
|
|
574
593
|
logger.debug("Failed to build scope for statement %d in %s: %s", stmt_index, path, exc)
|
|
575
594
|
sources = [
|
|
File without changes
|
|
File without changes
|