diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-01-30 17:08:33 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-01-30 17:08:33 +0000 |
commit | 75d158890b303b701c51f12b34c422fb823ba9aa (patch) | |
tree | 5f10a4a1eb612918ea94a934cfc9b9893ea19442 /tests/test_lineage.py | |
parent | Adding upstream version 10.5.6. (diff) | |
download | sqlglot-75d158890b303b701c51f12b34c422fb823ba9aa.tar.xz sqlglot-75d158890b303b701c51f12b34c422fb823ba9aa.zip |
Adding upstream version 10.5.10.upstream/10.5.10
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_lineage.py')
-rw-r--r-- | tests/test_lineage.py | 20 |
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) |