Fix #2678: Fixed vertica import errors and invalid dataTypeDisplay (#2709)

Co-authored-by: Mayur SIngal <mayursingal@Mayurs-MacBook-Pro.local>
This commit is contained in:
Mayur Singal 2022-02-10 20:52:29 +05:30 committed by GitHub
parent dc2c7c0fb7
commit c64f3fef34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 6 deletions

View File

@ -68,7 +68,8 @@
"SET",
"GEOGRAPHY",
"ENUM",
"JSON"
"JSON",
"UUID"
]
},
"constraint": {

View File

@ -522,13 +522,15 @@ class SQLSource(Source[OMetaDatabaseAndTable]):
repr(column["type"]), column["name"]
)
)
col_data_length = (
1 if col_data_length is None else col_data_length
)
dataTypeDisplay = (
f"{data_type_display}"
if data_type_display
else "{}({})".format(col_type, col_data_length)
if col_data_length
else col_type
)
col_data_length = (
1 if col_data_length is None else col_data_length
)
om_column = Column(
name=column["name"],

View File

@ -12,8 +12,10 @@
import re
from textwrap import dedent
from sqlalchemy import exc, sql
from sqlalchemy import exc, sql, util
from sqlalchemy.engine import reflection
from sqlalchemy.sql import sqltypes
from sqlalchemy.sql.sqltypes import VARCHAR, String
from sqlalchemy_vertica.base import VerticaDialect
from metadata.ingestion.ometa.openmetadata_rest import MetadataServerConfig
@ -26,6 +28,13 @@ from metadata.utils.sql_queries import (
)
class UUID(String):
"""The SQL UUID type."""
__visit_name__ = "UUID"
@reflection.cache
def get_columns(self, connection, table_name, schema=None, **kw):
if schema is not None:
@ -129,7 +138,7 @@ def _get_column_info(
args = ()
elif charlen:
args = (int(charlen),)
self.ischema_names["UUID"] = UUID
if attype.upper() in self.ischema_names:
coltype = self.ischema_names[attype.upper()]
else:

View File

@ -132,6 +132,7 @@ class ColumnTypeParser:
"VARIANT": "JSON",
"XML": "BINARY",
"XMLTYPE": "BINARY",
"UUID": "UUID",
}
_COMPLEX_TYPE = re.compile("^(struct|map|array|uniontype)")