Skip to content

Commit 616e1cd

Browse files
IceS2mohittilala
andauthored
Fixes #31790: [1.13] upgrade collate-sqllineage and require Python 3.10 (#31896)
* Fixes #31790: upgrade collate-sqllineage to 2.1.7 2.1.4 produces no column lineage for UPDATE and MERGE. Table lineage still resolves, so the gap is quiet: the graph looks populated while every column edge on those statements is missing. 2.1.7 also clears one of the sqlparse>=0.6.0 ceilings tracked in the issue. Update the lineage tests to assert the correct lineage instead of the empty result that encoded the old limitation. Two shapes are still unresolved upstream and stay marked xfail with the correct lineage asserted. * Revert "Force sqlparse 0.6.0 in the ingestion operator images to clear 4 CVEs (#31791)" collate-sqllineage 2.1.7 carries sqlparse 0.6.0 in its own metadata, so the resolver handles this without a --no-deps override and an import gate to keep it honest. Reverts 2e8f045. * Address review: drop xfail marks, use the existing parser-disable convention Greptile flagged that whole-test xfails also cover the table-lineage and parser checks, so an unrelated regression reports as XFAIL instead of failing. Use the per-parser flags the rest of the file already uses. merge_06 asserts the one edge all three parsers resolve, with a comment on why the two window ORDER BY edges are missing. merge_10 goes back to an empty expectation with SqlGlot and SqlParse disabled and their specific errors named, plus skip_graph_check on the table assertion since SqlGlot and SqlFluff build different internal shapes for the recursion. * Fixes #31790: require Python 3.10 for patched sqlparse * Fixes #31790: align 1.13 window lineage expectations --------- Co-authored-by: Mohit Tilala <tilalamohit123@gmail.com>
1 parent bc85f67 commit 616e1cd

8 files changed

Lines changed: 128 additions & 132 deletions

File tree

ingestion/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
This guide will help you setup the Ingestion framework and connectors
33
---
44

5-
![Python version 3.9+](https://img.shields.io/badge/python-3.9%2B-blue)
5+
![Python version 3.10+](https://img.shields.io/badge/python-3.10%2B-blue)
66

77
OpenMetadata Ingestion is a simple framework to build connectors and ingest metadata of various systems through OpenMetadata APIs. It could be used in an orchestration framework(e.g. Apache Airflow) to ingest metadata.
88
**Prerequisites**
99

10-
- Python &gt;= 3.9.x
10+
- Python &gt;= 3.10.x
1111

1212
### Docs
1313

ingestion/noxfile.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"""
1212
Nox sessions for testing and formatting checks.
1313
"""
14+
1415
import os
1516

1617
import nox
@@ -21,8 +22,6 @@
2122
# - Add integration tests
2223
# - Address the TODOs in the code
2324

24-
# TODO: Add python 3.9. PYTHON 3.9 fails in Mac os due to problem with `psycopg2-binary` package
25-
2625
SUPPORTED_PYTHON_VERSIONS = ["3.10", "3.11", "3.12"]
2726

2827

ingestion/operators/docker/Dockerfile

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -230,47 +230,10 @@ USER openmetadata
230230
# build-time only: cx_Oracle and mysqlclient import pkg_resources from their setup.py and
231231
# 81.0.0 removed it, but once built both import fine against 83+. Leaving 80.x on disk is
232232
# what keeps scanners reporting CVE-2026-59890.
233-
# Keep this the LAST pip layer that can compile anything -- a later layer that builds a
234-
# package needing pkg_resources would fail here, and the error would not look like a
235-
# setuptools problem. The sqlparse override below is a pure-Python wheel, so it is exempt.
233+
# Keep this the LAST pip layer -- a later layer that compiles a package needing
234+
# pkg_resources would fail here, and the error would not look like a setuptools problem.
236235
RUN pip install --upgrade "setuptools>=83"
237236

238-
# Force sqlparse past two declared ceilings to clear CVE-2026-54284, CVE-2026-59893,
239-
# CVE-2026-71491 (parser CPU-exhaustion DoS) and CVE-2026-59894 (SQL string breakout in
240-
# the python/php output formats). All four are fixed only in 0.6.0 -- OSV reports no
241-
# patched 0.5.x -- so no in-range version is clean and the resolver cannot help us:
242-
# collate-sqllineage 2.1.4 sqlparse==0.5.4
243-
# dbt-core (transitive via collate-data-diff) sqlparse<0.6.0
244-
# Both ceilings are stale rather than substantive. collate-sqllineage 2.1.5 shipped with
245-
# sqlparse==0.6.0 and 2.1.6 reverted only the pin to stay co-installable with dbt-core --
246-
# the two releases are byte-identical apart from the version string, so 0.6.0 is a version
247-
# upstream already released against. dbt-core's ceiling predates 0.6.0 by nine months and
248-
# is tracked at https://github.com/dbt-labs/dbt-core/issues/15988. Once that lands, delete
249-
# this layer and raise the floors in ingestion/setup.py instead.
250-
#
251-
# --no-deps because pip would otherwise backtrack on the declared conflict. `pip install`
252-
# exits 0 while printing the resolver-conflict ERROR, and `pip check` will report the two
253-
# unsatisfied pins for the life of the image, so the import gate is what actually keeps
254-
# this honest. It asserts the two things that would otherwise fail silently: that we really
255-
# got 0.6.x, and that collate-sqllineage's monkeypatch of sqlparse internals still bites.
256-
# That patch raises MAX_GROUPING_DEPTH/MAX_GROUPING_TOKENS 100x and retypes STRING as a
257-
# builtin; if a future sqlparse renames either, the patch degrades to a no-op and lineage
258-
# comes back quietly truncated with nothing failing.
259-
RUN pip install --no-deps "sqlparse==0.6.0" \
260-
&& python -W ignore -c "\
261-
import sqlparse; \
262-
from sqlparse.engine import grouping; \
263-
from sqlparse.keywords import KEYWORDS; \
264-
import collate_sqllineage.core.parser.sqlparse; \
265-
from collate_sqllineage.core.parser.sqlparse.analyzer import SqlParseLineageAnalyzer; \
266-
from collate_sqllineage.runner import LineageRunner; \
267-
assert sqlparse.__version__.startswith('0.6.'), sqlparse.__version__; \
268-
assert (grouping.MAX_GROUPING_DEPTH, grouping.MAX_GROUPING_TOKENS) == (10000, 1000000), 'sqllineage grouping patch is a no-op'; \
269-
assert str(KEYWORDS['STRING']) == 'Token.Name.Builtin', 'sqllineage keyword patch is a no-op'; \
270-
r = LineageRunner('INSERT INTO db.sch.tgt SELECT c FROM db.sch.src', analyzer=SqlParseLineageAnalyzer); \
271-
assert [str(t) for t in r.source_tables] == ['db.sch.src'], r.source_tables; \
272-
assert [str(t) for t in r.target_tables] == ['db.sch.tgt'], r.target_tables"
273-
274237

275238
# Strip spaCy's bundled test fixture, which scanners misreport as an installed black.
276239
# See ingestion/scripts/strip_spacy_test_fixture.sh for the rationale. Must run after the

ingestion/operators/docker/Dockerfile.ci

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -238,47 +238,10 @@ USER openmetadata
238238
# build-time only: cx_Oracle and mysqlclient import pkg_resources from their setup.py and
239239
# 81.0.0 removed it, but once built both import fine against 83+. Leaving 80.x on disk is
240240
# what keeps scanners reporting CVE-2026-59890.
241-
# Keep this the LAST pip layer that can compile anything -- a later layer that builds a
242-
# package needing pkg_resources would fail here, and the error would not look like a
243-
# setuptools problem. The sqlparse override below is a pure-Python wheel, so it is exempt.
241+
# Keep this the LAST pip layer -- a later layer that compiles a package needing
242+
# pkg_resources would fail here, and the error would not look like a setuptools problem.
244243
RUN pip install --upgrade "setuptools>=83"
245244

246-
# Force sqlparse past two declared ceilings to clear CVE-2026-54284, CVE-2026-59893,
247-
# CVE-2026-71491 (parser CPU-exhaustion DoS) and CVE-2026-59894 (SQL string breakout in
248-
# the python/php output formats). All four are fixed only in 0.6.0 -- OSV reports no
249-
# patched 0.5.x -- so no in-range version is clean and the resolver cannot help us:
250-
# collate-sqllineage 2.1.4 sqlparse==0.5.4
251-
# dbt-core (transitive via collate-data-diff) sqlparse<0.6.0
252-
# Both ceilings are stale rather than substantive. collate-sqllineage 2.1.5 shipped with
253-
# sqlparse==0.6.0 and 2.1.6 reverted only the pin to stay co-installable with dbt-core --
254-
# the two releases are byte-identical apart from the version string, so 0.6.0 is a version
255-
# upstream already released against. dbt-core's ceiling predates 0.6.0 by nine months and
256-
# is tracked at https://github.com/dbt-labs/dbt-core/issues/15988. Once that lands, delete
257-
# this layer and raise the floors in ingestion/setup.py instead.
258-
#
259-
# --no-deps because pip would otherwise backtrack on the declared conflict. `pip install`
260-
# exits 0 while printing the resolver-conflict ERROR, and `pip check` will report the two
261-
# unsatisfied pins for the life of the image, so the import gate is what actually keeps
262-
# this honest. It asserts the two things that would otherwise fail silently: that we really
263-
# got 0.6.x, and that collate-sqllineage's monkeypatch of sqlparse internals still bites.
264-
# That patch raises MAX_GROUPING_DEPTH/MAX_GROUPING_TOKENS 100x and retypes STRING as a
265-
# builtin; if a future sqlparse renames either, the patch degrades to a no-op and lineage
266-
# comes back quietly truncated with nothing failing.
267-
RUN pip install --no-deps "sqlparse==0.6.0" \
268-
&& python -W ignore -c "\
269-
import sqlparse; \
270-
from sqlparse.engine import grouping; \
271-
from sqlparse.keywords import KEYWORDS; \
272-
import collate_sqllineage.core.parser.sqlparse; \
273-
from collate_sqllineage.core.parser.sqlparse.analyzer import SqlParseLineageAnalyzer; \
274-
from collate_sqllineage.runner import LineageRunner; \
275-
assert sqlparse.__version__.startswith('0.6.'), sqlparse.__version__; \
276-
assert (grouping.MAX_GROUPING_DEPTH, grouping.MAX_GROUPING_TOKENS) == (10000, 1000000), 'sqllineage grouping patch is a no-op'; \
277-
assert str(KEYWORDS['STRING']) == 'Token.Name.Builtin', 'sqllineage keyword patch is a no-op'; \
278-
r = LineageRunner('INSERT INTO db.sch.tgt SELECT c FROM db.sch.src', analyzer=SqlParseLineageAnalyzer); \
279-
assert [str(t) for t in r.source_tables] == ['db.sch.src'], r.source_tables; \
280-
assert [str(t) for t in r.target_tables] == ['db.sch.tgt'], r.target_tables"
281-
282245

283246
# Strip spaCy's bundled test fixture, which scanners misreport as an installed black.
284247
# See ingestion/scripts/strip_spacy_test_fixture.sh for the rationale. Must run after the

ingestion/pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ authors = [
1313
]
1414
license = { file = "LICENSE" }
1515
description = "Ingestion Framework for OpenMetadata"
16-
requires-python = ">=3.9"
16+
requires-python = ">=3.10"
1717

1818
[project.urls]
1919
Homepage = "https://open-metadata.org/"
@@ -346,4 +346,3 @@ allowedUntypedLibraries = []
346346
# [[tool.basedpyright.executionEnvironments]]
347347
# root = "src/metadata/utils"
348348
# reportMissingParameterType = "error"
349-

ingestion/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@
180180
"requests>=2.23",
181181
"requests-aws4auth~=1.1", # Only depends on requests as external package. Leaving as base.
182182
"sqlalchemy>=2.0.0,<3",
183-
"collate-sqllineage==2.1.4",
183+
"collate-sqllineage==2.1.7",
184184
"tabulate==0.9.0",
185185
"tenacity>=8.0,<10",
186186
"typing-inspect",

0 commit comments

Comments
 (0)