refactor(ingest/mssql): centralize is_discovered_table cache-and-return#18122
Open
acrylJonny wants to merge 6 commits into
Open
refactor(ingest/mssql): centralize is_discovered_table cache-and-return#18122acrylJonny wants to merge 6 commits into
acrylJonny wants to merge 6 commits into
Conversation
…covered_datasets MSSQL stored-procedure bodies frequently reference tables as `schema.table` even though discovery records them fully qualified as `db.schema.table`. Previously, `is_discovered_table` treated any name with fewer than `MSSQL_QUALIFIED_NAME_PARTS` segments as undiscovered, which caused the temp-table filter to drop real lineage edges from procedures that use 2-part references. This adds a lookup pass for 2-part names: when `schema.table` matches the trailing two segments of a fully-qualified entry in `discovered_datasets`, treat the reference as a real table. 1-part names (and 2-part names that don't match anything) keep the previous undiscovered behaviour. Adds unit-test coverage for the match and no-match cases on top of the existing `is_discovered_table` test. Co-authored-by: Cursor <cursoragent@cursor.com>
…ests Address review feedback: collapse the trailing-segment match to a single endswith, document the intentional cross-DB first-match-wins behavior and pattern-filtering asymmetry, and add tests locking cross-DB matching and temp-filter precedence for 2-part references. Co-authored-by: Cursor <cursoragent@cursor.com>
60fe6f9 to
fdc9bc8
Compare
Extract an uncached _compute_is_discovered_table helper so each branch just returns its verdict, and let is_discovered_table own the single cache-and-return. Removes the ~8x repeated `result = ...; self._discovered_table_cache[name] = result; return result` epilogue and the risk of a future branch forgetting to populate the cache. Behavior is unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
fdc9bc8 to
7c61d63
Compare
Base automatically changed from
fix/mssql-2-part-name-temp-table-filtering
to
master
July 1, 2026 14:11
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to the DRY cleanup flagged in review on #17463 (thread).
_compute_is_discovered_tablehelper so each branch simply returns its verdict.is_discovered_tablenow owns the single cache-and-return, removing the ~8x repeatedresult = ...; self._discovered_table_cache[name] = result; return resultepilogue.Behavior is unchanged — pure refactor.
Test plan
pytest tests/unit/test_mssql.py— all 34 tests pass (existingis_discovered_tablecoverage exercises every branch)./gradlew :metadata-ingestion:lintFixcleanMade with Cursor