Skip to content

Commit

Permalink
Fix #18177: Fix Hive Metastore connection issue (#18178)
Browse files Browse the repository at this point in the history
  • Loading branch information
ulixius9 authored and harshach committed Oct 19, 2024
1 parent 829efe1 commit 070adba
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from typing import Any, Optional
from urllib.parse import quote_plus

from pydantic import SecretStr
from pydantic import SecretStr, ValidationError
from sqlalchemy.engine import Engine

from metadata.generated.schema.entity.automations.workflow import (
Expand Down Expand Up @@ -187,7 +187,22 @@ def test_connection(
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)

test_connection_db_schema_sources(
Expand Down

0 comments on commit 070adba

Please sign in to comment.