mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2026-01-06 04:26:57 +00:00
Fix: aggregate type (#9138)
This commit is contained in:
parent
5049c7db04
commit
e0a3f3481b
@ -12,11 +12,12 @@
|
||||
import enum
|
||||
import traceback
|
||||
|
||||
from clickhouse_sqlalchemy.drivers.base import ClickHouseDialect
|
||||
from clickhouse_sqlalchemy.drivers.base import ClickHouseDialect, ischema_names
|
||||
from clickhouse_sqlalchemy.drivers.http.transport import RequestsTransport, _get_type
|
||||
from clickhouse_sqlalchemy.drivers.http.utils import parse_tsv
|
||||
from sqlalchemy import types as sqltypes
|
||||
from sqlalchemy.engine import reflection
|
||||
from sqlalchemy.sql.sqltypes import String
|
||||
from sqlalchemy.util import warn
|
||||
|
||||
from metadata.generated.schema.entity.services.connections.database.clickhouseConnection import (
|
||||
@ -35,10 +36,17 @@ from metadata.utils.logger import ingestion_logger
|
||||
logger = ingestion_logger()
|
||||
|
||||
|
||||
class AggregateFunction(String):
|
||||
|
||||
__visit_name__ = "AggregateFunction"
|
||||
|
||||
|
||||
@reflection.cache
|
||||
def _get_column_type(
|
||||
self, name, spec
|
||||
): # pylint: disable=protected-access,too-many-branches,too-many-return-statements
|
||||
ischema_names.update({"AggregateFunction": AggregateFunction})
|
||||
ClickHouseDialect.ischema_names = ischema_names
|
||||
if spec.startswith("Array"):
|
||||
inner = spec[6:-1]
|
||||
coltype = self.ischema_names["_array"]
|
||||
@ -95,6 +103,8 @@ def _get_column_type(
|
||||
coltype = self.ischema_names["Decimal"]
|
||||
return coltype(*self._parse_decimal_params(spec))
|
||||
|
||||
if spec.lower().startswith("aggregatefunction"):
|
||||
return self.ischema_names["AggregateFunction"]
|
||||
try:
|
||||
return self.ischema_names[spec]
|
||||
except KeyError:
|
||||
|
||||
@ -192,6 +192,7 @@ class ColumnTypeParser:
|
||||
"UUID": "UUID",
|
||||
"POINT": "POINT",
|
||||
"POLYGON": "POLYGON",
|
||||
"AggregateFunction()": "AGGREGATEFUNCTION",
|
||||
"BYTEA": "BYTEA",
|
||||
}
|
||||
|
||||
|
||||
@ -96,7 +96,8 @@
|
||||
"GEOMETRY",
|
||||
"POINT",
|
||||
"POLYGON",
|
||||
"BYTEA"
|
||||
"BYTEA",
|
||||
"AGGREGATEFUNCTION"
|
||||
]
|
||||
},
|
||||
"constraint": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user