diff --git a/ingestion/src/metadata/ingestion/source/database/vertica/queries.py b/ingestion/src/metadata/ingestion/source/database/vertica/queries.py index 8bae6f32f1b..043abedafec 100644 --- a/ingestion/src/metadata/ingestion/source/database/vertica/queries.py +++ b/ingestion/src/metadata/ingestion/source/database/vertica/queries.py @@ -28,34 +28,37 @@ import textwrap # v_catalog.comments with v_catalog.columns. VERTICA_GET_COLUMNS = textwrap.dedent( """ - WITH - column_projection as - (SELECT - column_name, - data_type, - column_default, - is_nullable, - table_name, - table_schema, + WITH column_projection as ( + SELECT + column_id, proj.projection_name FROM v_catalog.columns col, v_catalog.projections proj - where proj.projection_id in (select + where lower(table_name) = '{table}' + AND {schema_condition} + AND proj.projection_id in ( + select min(projection_id) - from v_catalog.projections sub_proj - where col.table_id=sub_proj.anchor_table_id + from v_catalog.projections sub_proj + where col.table_id=sub_proj.anchor_table_id )) select column_name, data_type, column_default, is_nullable, - comment from column_projection col - LEFT JOIN v_catalog.comments com - ON com.object_type = 'COLUMN' - AND com.object_name = CONCAT(CONCAT(col.projection_name,'.'),col.column_name) - WHERE lower(table_name) = '{table}' - AND {schema_condition} + comment + from + v_catalog.columns col + LEFT JOIN column_projection proj ON proj.column_id = col.column_id + LEFT JOIN v_catalog.comments com ON com.object_type = 'COLUMN' + AND com.object_name = CONCAT( + CONCAT(proj.projection_name, '.'), + col.column_name + ) + WHERE + lower(table_name) = '{table}' + AND {schema_condition} UNION ALL SELECT column_name, diff --git a/ingestion/tests/cli_e2e/base/test_cli_db.py b/ingestion/tests/cli_e2e/base/test_cli_db.py index 3f94eb51b4d..640246144f3 100644 --- a/ingestion/tests/cli_e2e/base/test_cli_db.py +++ b/ingestion/tests/cli_e2e/base/test_cli_db.py @@ -12,6 +12,7 @@ """ Test database connectors with CLI """ +import time from abc import abstractmethod from typing import List, Optional from unittest import TestCase @@ -224,6 +225,9 @@ class CliDBBase(TestCase): ) self.delete_table_rows() self.update_table_row() + # Add 10 second delay for system + # tables to register the change + time.sleep(10) result = self.run_command("profile") sink_status, source_status = self.retrieve_statuses(result) self.assert_for_system_metrics(source_status, sink_status)