Repository: reata/sqllineage
Pull request #459 (2023-09-30 09:03:09)

feat: ignore lineage for analyze statement
making progress in #451 

codecov[bot]: ## [Codecov](https://app.codecov.io/gh/reata/sqllineage/pull/459?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) Report
> Merging [#459](https://app.codecov.io/gh/reata/sqllineage/pull/459?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) (59be376) into [master](https://app.codecov.io/gh/reata/sqllineage/commit/9f7f141d92f10925bf1163a95e2d7774bfad4ac6?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) (9f7f141) will **not change** coverage.
> The diff coverage is `n/a`.

```diff
@@           Coverage Diff           @@
##           master     #459   +/-   ##
=======================================
  Coverage   99.54%   99.54%           
=======================================
  Files          38       38           
  Lines        1987     1987           
=======================================
  Hits         1978     1978           
  Misses          9        9           
```


| [Files](https://app.codecov.io/gh/reata/sqllineage/pull/459?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | Coverage Δ | |
|---|---|---|
| [sqllineage/core/parser/sqlfluff/extractors/noop.py](https://app.codecov.io/gh/reata/sqllineage/pull/459?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c3FsbGluZWFnZS9jb3JlL3BhcnNlci9zcWxmbHVmZi9leHRyYWN0b3JzL25vb3AucHk=) | `100.00% <ø> (ø)` | |



Patch:
diff --git a/sqllineage/core/parser/sqlfluff/extractors/noop.py b/sqllineage/core/parser/sqlfluff/extractors/noop.py
index cccda2a..2c87957 100644
--- a/sqllineage/core/parser/sqlfluff/extractors/noop.py
+++ b/sqllineage/core/parser/sqlfluff/extractors/noop.py
@@ -19,6 +19,7 @@ class NoopExtractor(BaseExtractor):
         "show_statement",
         "use_statement",
         "declare_segment",
+        "analyze_statement",
     ]
 
     def extract(


Test patch:
diff --git a/tests/sql/table/other_single_statement/test_other_without_lineage_dialect_specific.py b/tests/sql/table/other_single_statement/test_other_without_lineage_dialect_specific.py
index fce59f0..6d2af4c 100644
--- a/tests/sql/table/other_single_statement/test_other_without_lineage_dialect_specific.py
+++ b/tests/sql/table/other_single_statement/test_other_without_lineage_dialect_specific.py
@@ -43,3 +43,13 @@ def test_uncache_table_if_exists(dialect: str):
 @pytest.mark.parametrize("dialect", ["databricks", "sparksql"])
 def test_show_create_table(dialect: str):
     assert_table_lineage_equal("show create table tab1", dialect=dialect)
+
+
+@pytest.mark.parametrize("dialect", ["postgres", "redshift"])
+def test_analyze_table(dialect: str):
+    assert_table_lineage_equal("analyze tab", dialect=dialect)
+
+
+@pytest.mark.parametrize("dialect", ["postgres", "redshift"])
+def test_analyze_table_column(dialect: str):
+    assert_table_lineage_equal("analyze tab (col1, col2)", dialect=dialect)