feat(sql): add debug logging for dropped tables and views in SQLAlchemy and Teradata sources#18136
Open
NehaGslab wants to merge 4 commits into
Open
Conversation
…my and Teradata sources
Contributor
|
Linear: ING-2951 Thanks for your contribution! We have created an internal ticket to track this PR. A member of the core DataHub team will be assigned to review it within the next few business days - you will get a follow-up comment once a reviewer is assigned. |
…n Teradata source tests
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
Adds
logger.debugvisibility at the points where tables and views are scanned anddropped by
table_pattern/view_pattern. Previously a Teradata run that filteredout every table/view still reported as "successful" with no indication of why
nothing was ingested — the dropped entities are only sampled into
report.filtered(a
LossyList), so there was no way to see which identifiers were denied or whatidentifier string was being matched against the patterns.
This mirrors the per-object debug logging BigQuery already emits, making pattern
misconfiguration (e.g. wrong case,
schema.tablevstableformat) diagnosableby re-running with debug logging enabled.
Changes
sql_common.py(SQLAlchemySource):loop_tables: log each table scanned and each table dropped bytable_pattern.loop_views: log each view scanned and each view dropped byview_pattern.(Teradata tables flow through the base
loop_tablesviacached_loop_tables.)teradata.py:_loop_views_with_connection_pool(multithreaded view path): log viewsscanned and dropped by
view_pattern._process_views_single_threaded(single-threaded view path): same logging.No behavioral change — only additional debug-level log lines. Filtering logic,
reporting, and emitted work units are unchanged.
Test plan
Added
TestFilterDropDebugLogginginmetadata-ingestion/tests/unit/test_teradata_source.py,covering every drop point where
table_pattern/view_patternfiltering occurs. Each testasserts the denied object is recorded in
report.filteredand its_process_*handler isnever invoked:
test_single_threaded_view_drop_reports_and_skips_processing— a view denied byview_patternon the single-threaded path (_process_views_single_threaded,max_workers=1) is recorded inreport.filteredand_process_viewis not called.test_multi_threaded_view_drop_reports_and_skips_processing— same behavior on themulti-threaded path (
_loop_views_with_connection_pool,max_workers=2).test_allowed_view_is_processed_and_not_dropped— a view that passesview_patternis handed to
_process_viewand does not appear inreport.filtered.test_table_drop_reports_and_skips_processing— a table denied bytable_pattern(flowing through
cached_loop_tables→ baseloop_tables) is recorded inreport.filteredand_process_tableis not called.Checklist