fix(clickhouse): extend MV TO-clause regex to cover POPULATE, UUID, and three-part names (#26265)#27827
Conversation
… clause (open-metadata#26265) Signed-off-by: Abhay Singh <abhaysingh0293@gmail.com>
Signed-off-by: Abhay Singh <abhaysingh0293@gmail.com>
…nd three-part names Fixes gaps in MATERIALIZED_VIEW_TO_PATTERN missed by PR open-metadata#27553: - POPULATE keyword before TO (valid ClickHouse DDL form) - UUID clause emitted by system.tables DDL output - Three-part qualified names (catalog.schema.table) - FROM keyword after target (bare FROM without AS keyword) Adds four regression tests for each new case. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
… annotation
Tuple from typing was shadowed by Tuple = create_sqlalchemy_type("Tuple")
on line 81. Using the built-in tuple[str, str] (Python 3.10+) removes the
ambiguity entirely and is safe under from __future__ import annotations.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
Code Review ✅ Approved 1 resolved / 1 findingsExtends the ClickHouse MV TO-clause regex to support POPULATE, UUID, and three-part table names. Shadowed typing.Tuple import has been resolved. ✅ 1 resolved✅ Quality: typing.Tuple shadowed by SQLAlchemy Tuple at module level
OptionsDisplay: compact → Showing less information. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
|
Closing — reopened as #27832 from correct account. |
Summary
Fixes gaps in the
MATERIALIZED_VIEW_TO_PATTERNregex introduced by #27553 for issue #26265.Four additional ClickHouse DDL forms were not matched:
POPULATEkeyword beforeTO— valid ClickHouse DDL supported since v22.xUUIDclause — emitted bysystem.tablesDDL output (e.g.CREATE MATERIALIZED VIEW db.mv UUID '...' TO db.target)catalog.schema.mv TO catalog2.schema2.targetFROMwithoutAS—CREATE MATERIALIZED VIEW mv TO target (...) FROM source(noAS SELECT)Changes:
_QUALIFIED_IDENTextended to match up to three dot-separated parts(?:\s+UUID\s+\S+)?optional clause after MV name(?:\s+POPULATE)?optional clause beforeTOFROM\bas an accepted token after the target table (alongside(andAS)TestGetMvToTargetTableBuilds on top of the approach in #27553 (same
query_lineage_produceroverride, sameget_mv_to_target_tablehelper) — no changes to that logic, only the regex coverage is extended.Test plan
TestGetMvToTargetTabletests still passtest_populate_keyword_before_to,test_on_cluster_and_populate_before_to,test_uuid_clause,test_three_part_qualified_namescd ingestion && python -m pytest tests/unit/topology/database/test_clickhouse_utils.py -v🤖 Generated with Claude Code