mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-25 17:04:54 +00:00
* Fix: Clickhouse view lineage * Fix: Clickhouse view lineage * Fix: Clickhouse view lineage
This commit is contained in:
parent
4ef1f4b729
commit
55b6fca9c9
@ -19,6 +19,9 @@ from sqlalchemy import util as sa_util
|
||||
from sqlalchemy.engine import reflection
|
||||
from sqlalchemy.util import warn
|
||||
|
||||
from metadata.generated.schema.entity.services.connections.database.clickhouseConnection import (
|
||||
ClickhouseConnection,
|
||||
)
|
||||
from metadata.generated.schema.entity.services.connections.metadata.openMetadataConnection import (
|
||||
OpenMetadataConnection,
|
||||
)
|
||||
@ -136,15 +139,23 @@ def get_table_comment(self, connection, table_name, schema=None, **kw):
|
||||
return {"text": None}
|
||||
|
||||
|
||||
@reflection.cache
|
||||
def get_view_definition(self, connection, view_name, schema=None, **kw):
|
||||
try:
|
||||
query = f"select create_table_query from system.tables where engine = 'View' and name='{view_name}' and database='{schema}'"
|
||||
result = connection.execute(query)
|
||||
view_definition = result.fetchone()
|
||||
return view_definition[0] if view_definition else ""
|
||||
except Exception:
|
||||
return ""
|
||||
|
||||
|
||||
ClickHouseDialect.get_unique_constraints = get_unique_constraints
|
||||
ClickHouseDialect.get_pk_constraint = get_pk_constraint
|
||||
ClickHouseDialect._get_column_type = _get_column_type
|
||||
ClickHouseDialect.get_table_comment = get_table_comment
|
||||
RequestsTransport.execute = execute
|
||||
|
||||
from metadata.generated.schema.entity.services.connections.database.clickhouseConnection import (
|
||||
ClickhouseConnection,
|
||||
)
|
||||
ClickHouseDialect.get_view_definition = get_view_definition
|
||||
|
||||
|
||||
class ClickhouseSource(SQLSource):
|
||||
|
Loading…
x
Reference in New Issue
Block a user