Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #18177: Fix Hive MetaStore connection issue #18178

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading