summaryrefslogtreecommitdiffstats
path: root/tests/test_lineage.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_lineage.py')
-rw-r--r--tests/test_lineage.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_lineage.py b/tests/test_lineage.py
new file mode 100644
index 0000000..7a48605
--- /dev/null
+++ b/tests/test_lineage.py
@@ -0,0 +1,20 @@
+import unittest
+
+from sqlglot.lineage import lineage
+
+
+class TestLineage(unittest.TestCase):
+ maxDiff = None
+
+ def test_lineage(self) -> None:
+ node = lineage(
+ "a",
+ "SELECT a FROM y",
+ schema={"x": {"a": "int"}},
+ sources={"y": "SELECT * FROM x"},
+ )
+ self.assertEqual(
+ node.source.sql(),
+ "SELECT y.a AS a FROM (SELECT x.a AS a FROM x AS x) AS y /* source: y */",
+ )
+ self.assertGreater(len(node.to_html()._repr_html_()), 1000)