Fixes #31515: include materialized views in PostgreSQL and Greenplum connectors - #31549
Conversation
…m connectors RELKIND_MAP was missing the 'm' entry for materialized views, and both POSTGRES_GET_TABLE_NAMES and GREENPLUM_GET_TABLE_NAMES excluded relkind = 'm' from their filters. As a result, materialized views were never discovered during ingestion. Adding 'm' → TableType.MaterializedView to the relkind map and extending the relkind filters in both queries fixes the omission. Fixes open-metadata#31515 > AI-generated code — reviewed and tested against OSS contribution guidelines.
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
|
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 ✅ ApprovedUpdates PostgreSQL and Greenplum connectors to discover materialized views by mapping the 'm' relkind and including it in table queries. No issues found. OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
Describe your changes:
Fixes #31515
The PostgreSQL and Greenplum ingestion connectors do not discover materialized views because two things were missing:
RELKIND_MAPincommon_pg_mappings.pyhad no'm'entry, so therelkindvalue returned for materialized views had no mapping toTableType.MaterializedView.POSTGRES_GET_TABLE_NAMESandGREENPLUM_GET_TABLE_NAMESonly filtered onrelkind in ('r', 'p', 'f'), which excludes'm'(materialized view) entirely.I added
"m": TableType.MaterializedViewtoRELKIND_MAPand extended both queries to include'm'in therelkindfilter.TableType.MaterializedViewalready exists in the generated schema (used by Snowflake, ClickHouse, BigQuery, and others), so no schema changes are needed.Type of change:
High-level design:
N/A — small change.
The
pg_class.relkindcolumn uses'm'for materialized views per the PostgreSQL catalog docs. The existing comment in both query files already listedm = materialized viewbut the filter never matched it.Tests:
Use cases covered
Unit tests
ingestion/tests/unit/topology/database/test_postgres.pytest_relkind_map_includes_materialized_view— assertsRELKIND_MAP['m'] == TableType.MaterializedViewtest_postgres_get_table_names_includes_materialized_view_relkind— assertsPOSTGRES_GET_TABLE_NAMEScontains'm'Backend integration tests
Ingestion integration tests
Playwright (UI) tests
Manual testing performed
Verified by code inspection:
TableType.MaterializedViewexists inmetadata.generated.schema.entity.data.table.RELKIND_MAP['m']resolves toTableType.MaterializedViewafter change.POSTGRES_GET_TABLE_NAMESnow includes'm'in therelkind in (...)filter.GREENPLUM_GET_TABLE_NAMESnow includes'm'in therelkind in (...)filter.UI screen recording / screenshots:
Not applicable.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #31515above.