mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-03 20:19:31 +00:00
Update view definition from Vertica dialect (#9980)
This commit is contained in:
parent
34df878427
commit
02c1f9ac94
@ -215,6 +215,19 @@ def _get_column_info( # pylint: disable=too-many-locals,too-many-branches,too-m
|
|||||||
def get_view_definition(
|
def get_view_definition(
|
||||||
self, connection, view_name, schema=None, **kw
|
self, connection, view_name, schema=None, **kw
|
||||||
): # pylint: disable=unused-argument,unused-argument
|
): # pylint: disable=unused-argument,unused-argument
|
||||||
|
"""
|
||||||
|
If we create a view as:
|
||||||
|
CREATE VIEW vendor_dimension_v AS
|
||||||
|
SELECT vendor_key, vendor_name
|
||||||
|
FROM public.vendor_dimension_new;
|
||||||
|
Then the VIEW_DEFINITION statement from V_CATALOG.VIEWS
|
||||||
|
will only contain the SELECT query:
|
||||||
|
SELECT vendor_key, vendor_name
|
||||||
|
FROM public.vendor_dimension_new;
|
||||||
|
We will add the `CREATE VIEW XYZ AS` piece
|
||||||
|
to ensure that the column lineage and target table
|
||||||
|
can be properly inferred.
|
||||||
|
"""
|
||||||
if schema is not None:
|
if schema is not None:
|
||||||
schema_condition = f"lower(table_schema) = '{schema.lower()}'"
|
schema_condition = f"lower(table_schema) = '{schema.lower()}'"
|
||||||
else:
|
else:
|
||||||
@ -229,7 +242,7 @@ def get_view_definition(
|
|||||||
)
|
)
|
||||||
rows = list(connection.execute(sql_query))
|
rows = list(connection.execute(sql_query))
|
||||||
if len(rows) >= 1:
|
if len(rows) >= 1:
|
||||||
return rows[0][0]
|
return f"CREATE VIEW {view_name} AS {rows[0][0]}"
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user