mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-27 01:45:32 +00:00
Fix vertica comments for version 9 (#11479)
This commit is contained in:
parent
074418eac3
commit
ddc3060184
@ -21,22 +21,39 @@ import textwrap
|
|||||||
# So to fetch column comments we need to concat the table_name + projection infix + column name.
|
# So to fetch column comments we need to concat the table_name + projection infix + column name.
|
||||||
# Example: querying `v_catalog.comments` we find an object_name for a column in the table vendor_dimension as
|
# Example: querying `v_catalog.comments` we find an object_name for a column in the table vendor_dimension as
|
||||||
# `vendor_dimension_super.vendor_name`. Note how this is the `_super` projection.
|
# `vendor_dimension_super.vendor_name`. Note how this is the `_super` projection.
|
||||||
# Then, our join looks for the match in `vendor_dimension_%.vendor_name`.
|
# Then, our join looks for the match in `vendor_dimension_super.vendor_name`.
|
||||||
|
# In case there are more than one projections available for a table then we pick up
|
||||||
|
# comments from any one projection available for table
|
||||||
# Note: This might not suit for all column scenarios, but currently we did not find a better way to join
|
# Note: This might not suit for all column scenarios, but currently we did not find a better way to join
|
||||||
# v_catalog.comments with v_catalog.columns.
|
# v_catalog.comments with v_catalog.columns.
|
||||||
VERTICA_GET_COLUMNS = textwrap.dedent(
|
VERTICA_GET_COLUMNS = textwrap.dedent(
|
||||||
"""
|
"""
|
||||||
SELECT
|
WITH
|
||||||
|
column_projection as
|
||||||
|
(SELECT
|
||||||
column_name,
|
column_name,
|
||||||
data_type,
|
data_type,
|
||||||
column_default,
|
column_default,
|
||||||
is_nullable,
|
is_nullable,
|
||||||
comment
|
table_name,
|
||||||
FROM v_catalog.columns col
|
table_schema,
|
||||||
|
proj.projection_name
|
||||||
|
FROM v_catalog.columns col,
|
||||||
|
v_catalog.projections proj
|
||||||
|
where proj.projection_id in (select
|
||||||
|
min(projection_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
|
LEFT JOIN v_catalog.comments com
|
||||||
ON com.object_type = 'COLUMN'
|
ON com.object_type = 'COLUMN'
|
||||||
AND com.object_id = col.table_id
|
AND com.object_name = CONCAT(CONCAT(col.projection_name,'.'),col.column_name)
|
||||||
AND com.child_object = col.column_name
|
|
||||||
WHERE lower(table_name) = '{table}'
|
WHERE lower(table_name) = '{table}'
|
||||||
AND {schema_condition}
|
AND {schema_condition}
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user