Skip to content

Feat/issue 28620 exasol add access to comments - #28621

Merged
ulixius9 merged 39 commits into
open-metadata:mainfrom
exasol:feat/ISSUE-28620-exasol_add_access_to_comments
Jun 18, 2026
Merged

ulixius9 merged 39 commits into
open-metadata:mainfrom
exasol:feat/ISSUE-28620-exasol_add_access_to_comments

Conversation

@ArBridgeman

@ArBridgeman ArBridgeman commented Jun 2, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #28620

I worked on:

Type of change:

  • New feature

High-level design:

N/A

Tests:

Use cases covered

  • Users can comment on one or more columns in a table. When they run metadata ingestion, this would show up in the UI.

Unit tests

  • (added) ingestion/tests/unit/observability/profiler/sqlalchemy/exasol/test_exasol_profiler_interface.py

    • test_compute_system_metrics_skips_views
    • test_compute_system_metrics_delegates_for_regular_tables
  • (added) ingestion/tests/unit/observability/profiler/sqlalchemy/exasol/test_system.py

    • test_get_queries_filters_rows_and_builds_expected_params
    • test_get_queries_returns_empty_when_schema_or_table_missing
    • test_get_table_match_pattern_escapes_regex_characters
    • test_get_metric_result_filters_by_table_name
  • (changed) ingestion/tests/unit/observability/profiler/test_table_metric_computer.py

    • test_compute_uses_view_metrics_for_views
    • test_compute_uses_view_metrics_for_materialized_views
    • test_compute_view_metrics_falls_back_to_base_compute
    • test_compute_table_metrics_returns_none_when_no_result
    • test_compute_table_metrics_falls_back_on_none_row_count
    • test_compute_table_metrics_falls_back_on_zero_row_count_for_view

Backend integration tests

Ingestion integration tests

  • (added) ingestion/tests/integration/sources/database/exasol/test_exasol_queries.py

    • test_connection_test_get_queries
    • test_sql_statement_query
    • test_system_metrics_query_ignores_similarly_named_tables
  • (changed) ingestion/tests/cli_e2e/test_cli_exasol.py

    • test_table_metadata_contains_comments

Playwright (UI) tests

Manual testing performed

UI screen recording / screenshots:

Not applicable.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.
  • For UI changes: I attached a screen recording and/or screenshots above.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.

Summary by Gitar

  • Exasol metadata ingestion:
    • Bumped sqlalchemy-exasol to 7.1.1 to enable column-level comment reflection and added luigi dependency.
    • Updated exasol.json test configuration to require SELECT ANY DICTIONARY privileges for auditing.
  • Profiler and metrics:
    • Implemented ExasolProfilerInterface and ExasolSystemMetricsComputer to enable DML operation tracking (INSERT, UPDATE, DELETE) via audit logs.
    • Refactored ExasolTableMetricComputer to optimize catalog queries and properly handle view metrics.
    • Enabled ModuloFn for the Exasol dialect.
  • Test suite expansion:
    • Added comprehensive integration tests for query and system metric logic in tests/integration/sources/database/exasol/.
    • Enhanced CLI E2E tests in tests/cli_e2e/test_cli_exasol.py to verify comment extraction and table profiling.

This will update automatically on new commits.

Greptile Summary

This PR adds column-level comment ingestion for Exasol by bumping sqlalchemy_exasol to 7.1.1 (which natively supports get_table_comment) and removing the now-redundant custom override. It also introduces a complete profiler stack for Exasol: a new ExasolProfilerInterface (skipping system metrics for views), ExasolSystemMetricsComputer (tracking INSERT/UPDATE/DELETE via EXA_STATISTICS.EXA_DBA_AUDIT_SQL), and a refactored ExasolTableMetricComputer that correctly handles views vs tables.

  • Removes test-only packages (exasol-integration-test-docker-environment, luigi) from the production plugin into a separate exasol-test extras key, and fixes the audit table references by qualifying them with the EXA_STATISTICS. schema prefix.
  • Fixes the EXA_ALL_OBJECT_SIZES join column from SCHEMA_NAME to ROOT_NAME and adds proper .upper() coercion for catalog lookups.
  • Adds comprehensive unit, integration, and CLI E2E tests covering comment extraction, system metric queries, and table disambiguation.

Confidence Score: 5/5

Safe to merge; the changes are well-contained, all new code paths are covered by unit and integration tests, and the production plugin dependency list is now correctly trimmed.

The core logic changes (comment ingestion, system metrics, table metric refactor) are correct and thoroughly tested. No existing behaviour is regressed. The only gaps are two missing init.py files (package and test directory), which are convention issues and do not affect runtime correctness under Python 3.3+ namespace packages.

Add init.py to ingestion/src/metadata/profiler/interface/sqlalchemy/exasol/ and ingestion/tests/unit/observability/profiler/sqlalchemy/exasol/ to match the convention followed by every peer directory.

Important Files Changed

Filename Overview
ingestion/setup.py Moves test-only Exasol docker infra out of the production plugin into a new exasol-test extras key; bumps sqlalchemy_exasol to 7.1.1 to gain native column-comment reflection.
ingestion/src/metadata/ingestion/source/database/exasol/queries.py Qualifies audit tables with the EXA_STATISTICS. schema prefix; replaces EXASOL_GET_TABLE_COMMENTS with a new parameterized EXASOL_SYSTEM_METRICS_QUERY for DML tracking.
ingestion/src/metadata/profiler/metrics/system/exasol/system.py New ExasolSystemMetricsComputer with per-operation caching, regex-based table matching via REGEXP_LIKE, and proper filtering of rows/null values; well-tested.
ingestion/src/metadata/profiler/interface/sqlalchemy/exasol/profiler_interface.py New ExasolProfilerInterface that skips system metrics for views; missing init.py in the package directory compared to all peer dialect directories.
ingestion/src/metadata/profiler/orm/functions/table_metric_computer.py Refactors ExasolTableMetricComputer.compute() into _compute_table_metrics / _compute_view_metrics; fixes column name from SCHEMA_NAME to ROOT_NAME in EXA_ALL_OBJECT_SIZES and adds proper .upper() for catalog lookups.
ingestion/tests/integration/sources/database/exasol/test_exasol_queries.py New integration tests that spin up a real Exasol container and verify SQL-statement, test-query, and system-metrics queries, including the DATATYPES vs DATATYPES_EXTRA disambiguation test.
ingestion/tests/unit/observability/profiler/sqlalchemy/exasol/test_system.py Unit tests for ExasolSystemMetricsComputer; test directory is missing an init.py unlike all peer test dialect directories.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant SC as ServiceSpec
    participant EPI as ExasolProfilerInterface
    participant ESMC as ExasolSystemMetricsComputer
    participant DB as EXA_STATISTICS.EXA_DBA_AUDIT_SQL
    participant ETMC as ExasolTableMetricComputer
    participant SYS as SYS.EXA_ALL_TABLES

    SC->>EPI: _compute_system_metrics(metrics, runner)
    alt tableType is View or MaterializedView
        EPI-->>SC: return []
    else Regular table
        EPI->>ESMC: __init__(session, runner)
        EPI->>ESMC: get_system_metrics()
        ESMC->>ESMC: get_inserts() + get_deletes() + get_updates()
        ESMC->>DB: "REGEXP_LIKE :table_match_pattern WHERE command_name=:operation"
        DB-->>ESMC: audit rows (start_time, row_count)
        ESMC-->>EPI: List[SystemProfile]
        EPI-->>SC: List[SystemProfile]
    end

    SC->>ETMC: compute()
    alt tableType is View or MaterializedView
        ETMC->>ETMC: "_compute_view_metrics() => super().compute()"
    else Regular table
        ETMC->>ETMC: _compute_table_metrics()
        ETMC->>SYS: SELECT TABLE_ROW_COUNT FROM EXA_ALL_TABLES JOIN EXA_ALL_OBJECT_SIZES
        SYS-->>ETMC: row count + size
        ETMC-->>SC: result row
    end
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant SC as ServiceSpec
    participant EPI as ExasolProfilerInterface
    participant ESMC as ExasolSystemMetricsComputer
    participant DB as EXA_STATISTICS.EXA_DBA_AUDIT_SQL
    participant ETMC as ExasolTableMetricComputer
    participant SYS as SYS.EXA_ALL_TABLES

    SC->>EPI: _compute_system_metrics(metrics, runner)
    alt tableType is View or MaterializedView
        EPI-->>SC: return []
    else Regular table
        EPI->>ESMC: __init__(session, runner)
        EPI->>ESMC: get_system_metrics()
        ESMC->>ESMC: get_inserts() + get_deletes() + get_updates()
        ESMC->>DB: "REGEXP_LIKE :table_match_pattern WHERE command_name=:operation"
        DB-->>ESMC: audit rows (start_time, row_count)
        ESMC-->>EPI: List[SystemProfile]
        EPI-->>SC: List[SystemProfile]
    end

    SC->>ETMC: compute()
    alt tableType is View or MaterializedView
        ETMC->>ETMC: "_compute_view_metrics() => super().compute()"
    else Regular table
        ETMC->>ETMC: _compute_table_metrics()
        ETMC->>SYS: SELECT TABLE_ROW_COUNT FROM EXA_ALL_TABLES JOIN EXA_ALL_OBJECT_SIZES
        SYS-->>ETMC: row count + size
        ETMC-->>SC: result row
    end
Loading

Reviews (2): Last reviewed commit: "Move exasol-test to its own defined plug..." | Re-trigger Greptile

@github-actions

github-actions Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

from metadata.utils.service_spec.default import DefaultDatabaseSpec

ServiceSpec = DefaultDatabaseSpec(
profiler_class=ExasolProfilerInterface, # pyright: ignore[reportArgumentType]

@ArBridgeman ArBridgeman Jun 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to otherwise activate profiler yet, as not all the components are ready based on our local testing.

This was mostly to resolve this test from failing test_create_table_with_profiler, and we believe is a result of the work done by another OMD developer in #27912

@github-actions

github-actions Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@ArBridgeman

ArBridgeman commented Jun 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Hi @tutte , @ulixius9 , @akash-jain-10 , @harshach ,

I'd initially created a draft PR to handle the comments from gitar-bot, but it looks like it didn't automatically add any reviewers when I switched it to ready. Hopefully, you're the right ones to take a look at this; I assumed as you were listed on my last PR #27661

Hi @tutte , @ulixius9 , @akash-jain-10 , @harshach ,

Could I get some feedback? I believe I've handled the various CI checks related to what I've added. Please let me know if there are failing tests which I should address; it seems like some of the tests run in the CI have periodic flakey failures, but as an external collaborator, I am unable to re-run them in GitHub.

Comment thread ingestion/setup.py Resolved
@sonarqubecloud

Copy link
Copy Markdown

@gitar-bot

gitar-bot Bot commented Jun 18, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 6 resolved / 6 findings

Enables Exasol column-level comment access by upgrading the SQLAlchemy driver and refactoring the profiling interface. Includes comprehensive new integration tests, addressing all previously identified SQL injection, caching, and matching logic issues.

✅ 6 resolved
✅ Security: EXASOL_SYSTEM_METRICS_QUERY uses string formatting, not parameterized SQL

📄 ingestion/src/metadata/ingestion/source/database/exasol/queries.py:63-77 📄 ingestion/src/metadata/profiler/metrics/system/exasol/system.py:82-89
The EXASOL_SYSTEM_METRICS_QUERY injects schema, table, database_name, and operations via Python .format() directly into the SQL string (line 75: LIKE UPPER('%{schema}.{table}%')). While these values currently originate from internal metadata (runner.schema_name, runner.table_name), this pattern is vulnerable to SQL injection if any of these values contain special characters (e.g., a schema named foo'; DROP TABLE --). In contrast, the EXASOL_GET_COLUMN_COMMENTS query in the same file correctly uses parameterized queries with :schema and :table_name placeholders.

Note: the LIKE clause makes full parameterization tricky, but at minimum the values should be sanitized or the query restructured to use bind parameters where possible.

✅ Performance: Double @reflection.cache on get_columns may cause stale results

📄 ingestion/src/metadata/ingestion/source/database/exasol/sqla_utils.py:32-43
The custom get_columns in sqla_utils.py is decorated with @reflection.cache, but it delegates to get_columns._original which is EXADialect.get_columns — itself likely decorated with @reflection.cache. This creates a double-caching layer. The outer cache will cache the enriched result (with comments), meaning if comments are updated the cache won't be invalidated. Additionally, the inner cached result is already stored, so there's unnecessary overhead.

Consider removing the @reflection.cache from the custom wrapper if the original already handles caching, or verify that caching the enriched result is the intended behavior.

✅ Edge Case: LIKE-based table matching in system metrics may match wrong tables

📄 ingestion/src/metadata/ingestion/source/database/exasol/queries.py:75
The EXASOL_SYSTEM_METRICS_QUERY uses UPPER(s.sql_text) LIKE UPPER('%{schema}.{table}%') to identify DML operations on a specific table. This pattern can produce false positives — for example, a table named foo would match queries against foo_bar, or a query that references schema.table in a comment or string literal would be counted. Other system metrics implementations typically use more precise catalog views rather than text matching on SQL statements.

✅ Bug: NOT LIKE filters broken after removing .format() escaping

📄 ingestion/src/metadata/ingestion/source/database/exasol/queries.py:76-77
The query EXASOL_SYSTEM_METRICS_QUERY previously had {{ and }} as escape sequences for Python's .format() method (producing literal { and }). Now that the query is used with text() + bind parameters instead of .format(), these doubled braces are no longer unescaped and will be sent literally as {{ and }} to the database.

This means the NOT LIKE filters on lines 76-77 will look for literal {{"app": "OpenMetadata"...}} in SQL text, but actual query headers use single braces {"app": "OpenMetadata"...}. As a result, internal OpenMetadata and dbt queries will no longer be excluded from system metrics, potentially inflating row counts.

✅ Quality: Leftover diagnostic subprocess printing luigi version in setup_class

📄 ingestion/tests/integration/sources/database/exasol/test_exasol_queries.py:115-122
The new subprocess.run([sys.executable, "-c", "import luigi; print(...)"]) block at the top of setup_class is diagnostic-only code. The commit message confirms it was added to "output to see what is going wrong on the broken shards". It serves no purpose for the test itself and spawns an extra Python process on every test run. It should be removed before merge so the test setup only does work it actually needs (pulling the docker image and spawning the test environment).

...and 1 more resolved from earlier reviews

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

This branch was previously deployed

1 inactive deployment
test — 06b3ea90 Deployed Jun 16, 2026 by ArBridgeman via playwright-ci-postgresql (2, 6) #51296
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extend Exasol implementation to include column-level comments

2 participants