sql-glider 0.1.18__py3-none-any.whl → 0.1.20__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_glider-0.1.18.dist-info → sql_glider-0.1.20.dist-info}/METADATA +1 -1
- {sql_glider-0.1.18.dist-info → sql_glider-0.1.20.dist-info}/RECORD +7 -7
- sqlglider/_version.py +2 -2
- sqlglider/lineage/analyzer.py +43 -20
- {sql_glider-0.1.18.dist-info → sql_glider-0.1.20.dist-info}/WHEEL +0 -0
- {sql_glider-0.1.18.dist-info → sql_glider-0.1.20.dist-info}/entry_points.txt +0 -0
- {sql_glider-0.1.18.dist-info → sql_glider-0.1.20.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sql-glider
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.20
|
|
4
4
|
Summary: SQL Utility Toolkit for better understanding, use, and governance of your queries in a native environment.
|
|
5
5
|
Project-URL: Homepage, https://github.com/rycowhi/sql-glider/
|
|
6
6
|
Project-URL: Repository, https://github.com/rycowhi/sql-glider/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
sqlglider/__init__.py,sha256=gDf7s52dMcX7JuCZ1SLawcB1vb3U0yJCohu9RQAATBY,125
|
|
2
|
-
sqlglider/_version.py,sha256=
|
|
2
|
+
sqlglider/_version.py,sha256=P88Jfo9OvOr8LB0vHFqLUwFR7A0eE281KxEewbcCSBc,706
|
|
3
3
|
sqlglider/cli.py,sha256=9zNMaw3rgcqb6uG05VJTYbLUXmZzdX87gAOJ4Zg3xjY,65319
|
|
4
4
|
sqlglider/global_models.py,sha256=2vyJXAuXOsXQpE-D3F0ejj7eR9z0nDWFjTkielhzM8k,356
|
|
5
5
|
sqlglider/catalog/__init__.py,sha256=2PqFPyzFXJ14FpSUcBmVK2L-a_ypWQHAbHFHxLDk_LE,814
|
|
@@ -18,7 +18,7 @@ sqlglider/graph/models.py,sha256=EYmjv_WzDSNp_WfhJ6H-qBIOkAcoNKS7GRUryfKrHuY,933
|
|
|
18
18
|
sqlglider/graph/query.py,sha256=LHU8Cvn7ZPPSEnqdDn2pF8f1_LQjIvNIrZqs8cFlb6U,9433
|
|
19
19
|
sqlglider/graph/serialization.py,sha256=vMXn7s35jA499e7l90vNVaJE_3QR_VHf3rEfQ9ZlgTQ,2781
|
|
20
20
|
sqlglider/lineage/__init__.py,sha256=llXMeI5_PIZaiBo8tKk3-wOubF4m_6QBHbn1FtWxT7k,256
|
|
21
|
-
sqlglider/lineage/analyzer.py,sha256=
|
|
21
|
+
sqlglider/lineage/analyzer.py,sha256=DE46C8vfi2DmXXqAryNJ7qI0ARsF7pLf8qJBy1k3TRw,79202
|
|
22
22
|
sqlglider/lineage/formatters.py,sha256=_Y9wcTX4JXn1vVnZ1xI656g1FF2rMjcAVc-GHjbd9QA,10389
|
|
23
23
|
sqlglider/schema/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
24
|
sqlglider/schema/extractor.py,sha256=P7sVCmBACQ55D8wHS7munbTg0dvJ3-NnUzXf9ZgCAOA,7574
|
|
@@ -31,8 +31,8 @@ sqlglider/utils/__init__.py,sha256=KGp9-UzKz_OFBOTFoSy-g-NXDZsvyWXG_9-1zcC6ePE,2
|
|
|
31
31
|
sqlglider/utils/config.py,sha256=qx5zE9pjLCCzHQDFVPLVd7LgJ-lghxUa2x-aZOAHByY,4962
|
|
32
32
|
sqlglider/utils/file_utils.py,sha256=5_ff28E0r1R7emZzsOnRuHd-7zIX6873eyr1SuPEr4E,1093
|
|
33
33
|
sqlglider/utils/schema.py,sha256=LiWrYDunXKJdoSlpKmIaIQ2hLSaIN1iQHqkXjMpGzRE,1883
|
|
34
|
-
sql_glider-0.1.
|
|
35
|
-
sql_glider-0.1.
|
|
36
|
-
sql_glider-0.1.
|
|
37
|
-
sql_glider-0.1.
|
|
38
|
-
sql_glider-0.1.
|
|
34
|
+
sql_glider-0.1.20.dist-info/METADATA,sha256=tC3YZY7IuxfVzi7GvYEw_2JAD20rPwfWecg2YHMS3Pg,28446
|
|
35
|
+
sql_glider-0.1.20.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
36
|
+
sql_glider-0.1.20.dist-info/entry_points.txt,sha256=HDuakHqHS5C0HFKsMIxMYmDU7-BLBGrnIJcYaVRu-s0,251
|
|
37
|
+
sql_glider-0.1.20.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
38
|
+
sql_glider-0.1.20.dist-info/RECORD,,
|
sqlglider/_version.py
CHANGED
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '0.1.
|
|
32
|
-
__version_tuple__ = version_tuple = (0, 1,
|
|
31
|
+
__version__ = version = '0.1.20'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 1, 20)
|
|
33
33
|
|
|
34
34
|
__commit_id__ = commit_id = None
|
sqlglider/lineage/analyzer.py
CHANGED
|
@@ -1480,7 +1480,7 @@ class LineageAnalyzer:
|
|
|
1480
1480
|
|
|
1481
1481
|
def _extract_schema_from_statement(self, expr: exp.Expression) -> None:
|
|
1482
1482
|
"""
|
|
1483
|
-
Extract column definitions from CREATE VIEW/TABLE AS SELECT statements.
|
|
1483
|
+
Extract column definitions from CREATE VIEW/TABLE AS SELECT and CACHE TABLE statements.
|
|
1484
1484
|
|
|
1485
1485
|
This method builds up file-scoped schema context as statements are processed,
|
|
1486
1486
|
enabling SQLGlot to correctly expand SELECT * and trace cross-statement references.
|
|
@@ -1488,29 +1488,39 @@ class LineageAnalyzer:
|
|
|
1488
1488
|
Args:
|
|
1489
1489
|
expr: The SQL expression to extract schema from
|
|
1490
1490
|
"""
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
return
|
|
1494
|
-
if expr.kind not in ("VIEW", "TABLE"):
|
|
1495
|
-
return
|
|
1491
|
+
target_name: str | None = None
|
|
1492
|
+
select_node: exp.Expression | None = None
|
|
1496
1493
|
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1494
|
+
if isinstance(expr, exp.Create):
|
|
1495
|
+
if expr.kind not in ("VIEW", "TABLE"):
|
|
1496
|
+
return
|
|
1497
|
+
|
|
1498
|
+
target = expr.this
|
|
1499
|
+
if isinstance(target, exp.Schema):
|
|
1500
|
+
target = target.this
|
|
1501
|
+
if not isinstance(target, exp.Table):
|
|
1502
|
+
return
|
|
1503
|
+
|
|
1504
|
+
target_name = self._get_qualified_table_name(target)
|
|
1505
|
+
select_node = expr.expression
|
|
1506
|
+
|
|
1507
|
+
# Handle Subquery wrapper (e.g., CREATE VIEW AS (SELECT ...))
|
|
1508
|
+
if isinstance(select_node, exp.Subquery):
|
|
1509
|
+
select_node = select_node.this
|
|
1510
|
+
|
|
1511
|
+
elif isinstance(expr, exp.Cache):
|
|
1512
|
+
target = expr.this
|
|
1513
|
+
if not isinstance(target, exp.Table):
|
|
1514
|
+
return
|
|
1503
1515
|
|
|
1504
|
-
|
|
1516
|
+
target_name = self._get_qualified_table_name(target)
|
|
1517
|
+
select_node = expr.expression
|
|
1505
1518
|
|
|
1506
|
-
|
|
1507
|
-
select_node = expr.expression
|
|
1508
|
-
if select_node is None:
|
|
1519
|
+
else:
|
|
1509
1520
|
return
|
|
1510
1521
|
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
select_node = select_node.this
|
|
1522
|
+
if target_name is None or select_node is None:
|
|
1523
|
+
return
|
|
1514
1524
|
|
|
1515
1525
|
if not isinstance(
|
|
1516
1526
|
select_node, (exp.Select, exp.Union, exp.Intersect, exp.Except)
|
|
@@ -1822,7 +1832,13 @@ class LineageAnalyzer:
|
|
|
1822
1832
|
if actual_name in self._file_schema:
|
|
1823
1833
|
return list(self._file_schema[actual_name].keys())
|
|
1824
1834
|
|
|
1825
|
-
# Check
|
|
1835
|
+
# Check if it's an aliased subquery (e.g., FROM (SELECT ...) sub)
|
|
1836
|
+
if isinstance(source, exp.Subquery) and source.alias == table_name:
|
|
1837
|
+
inner_select = source.this
|
|
1838
|
+
if isinstance(inner_select, exp.Select):
|
|
1839
|
+
return self._extract_subquery_columns(inner_select)
|
|
1840
|
+
|
|
1841
|
+
# Check JOIN clauses for aliased tables and subqueries
|
|
1826
1842
|
joins = select_node.args.get("joins")
|
|
1827
1843
|
if joins:
|
|
1828
1844
|
for join in joins:
|
|
@@ -1835,6 +1851,13 @@ class LineageAnalyzer:
|
|
|
1835
1851
|
actual_name = self._get_qualified_table_name(join_source)
|
|
1836
1852
|
if actual_name in self._file_schema:
|
|
1837
1853
|
return list(self._file_schema[actual_name].keys())
|
|
1854
|
+
if (
|
|
1855
|
+
isinstance(join_source, exp.Subquery)
|
|
1856
|
+
and join_source.alias == table_name
|
|
1857
|
+
):
|
|
1858
|
+
inner_select = join_source.this
|
|
1859
|
+
if isinstance(inner_select, exp.Select):
|
|
1860
|
+
return self._extract_subquery_columns(inner_select)
|
|
1838
1861
|
|
|
1839
1862
|
return []
|
|
1840
1863
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|