mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-27 18:36:08 +00:00
parent
675a93c61d
commit
e21843b752
@ -18,7 +18,7 @@ from functools import singledispatch
|
|||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
from urllib.parse import quote_plus
|
from urllib.parse import quote_plus
|
||||||
|
|
||||||
from pydantic import SecretStr
|
from pydantic import SecretStr, ValidationError
|
||||||
from sqlalchemy.engine import Engine
|
from sqlalchemy.engine import Engine
|
||||||
|
|
||||||
from metadata.generated.schema.entity.automations.workflow import (
|
from metadata.generated.schema.entity.automations.workflow import (
|
||||||
@ -187,7 +187,22 @@ def test_connection(
|
|||||||
of a metadata workflow or during an Automation Workflow
|
of a metadata workflow or during an Automation Workflow
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if service_connection.metastoreConnection:
|
if service_connection.metastoreConnection and isinstance(
|
||||||
|
service_connection.metastoreConnection, dict
|
||||||
|
):
|
||||||
|
try:
|
||||||
|
service_connection.metastoreConnection = MysqlConnection.model_validate(
|
||||||
|
service_connection.metastoreConnection
|
||||||
|
)
|
||||||
|
except ValidationError:
|
||||||
|
try:
|
||||||
|
service_connection.metastoreConnection = (
|
||||||
|
PostgresConnection.model_validate(
|
||||||
|
service_connection.metastoreConnection
|
||||||
|
)
|
||||||
|
)
|
||||||
|
except ValidationError:
|
||||||
|
raise ValueError("Invalid metastore connection")
|
||||||
engine = get_metastore_connection(service_connection.metastoreConnection)
|
engine = get_metastore_connection(service_connection.metastoreConnection)
|
||||||
|
|
||||||
test_connection_db_schema_sources(
|
test_connection_db_schema_sources(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user