Skip to content

Commit

Permalink
fix query for mysql con. (#18272)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshsoni2024 authored Oct 15, 2024
1 parent 62ee79e commit eb49d7a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ def test_connection(
else:
test_fn["CheckAccess"] = partial(test_connection_engine_step, client)
test_fn["GetDashboards"] = partial(test_query, client, FETCH_DASHBOARDS_TEST)
test_fn["GetCharts"] = partial(test_query, client, FETCH_ALL_CHARTS_TEST)
if isinstance(service_connection.connection, MysqlConnection):
test_fn["GetCharts"] = partial(
test_query, client, FETCH_ALL_CHARTS_TEST.replace('"', "`")
)
else:
test_fn["GetCharts"] = partial(test_query, client, FETCH_ALL_CHARTS_TEST)

test_connection_steps(
metadata=metadata,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
from metadata.generated.schema.entity.data.chart import Chart
from metadata.generated.schema.entity.data.dashboardDataModel import DataModelType
from metadata.generated.schema.entity.data.table import Table
from metadata.generated.schema.entity.services.connections.database.mysqlConnection import (
MysqlConnection,
)
from metadata.generated.schema.entity.services.databaseService import DatabaseService
from metadata.generated.schema.entity.services.ingestionPipelines.status import (
StackTraceError,
Expand Down Expand Up @@ -81,7 +84,10 @@ def prepare(self):
the required information which is not available in fetch_charts_with_id api
"""
try:
charts = self.engine.execute(FETCH_ALL_CHARTS)
if isinstance(self.service_connection.connection, MysqlConnection):
charts = self.engine.execute(FETCH_ALL_CHARTS.replace('"', "`"))
else:
charts = self.engine.execute(FETCH_ALL_CHARTS)
for chart in charts:
chart_detail = FetchChart(**chart)
self.all_charts[chart_detail.id] = chart_detail
Expand Down

0 comments on commit eb49d7a

Please sign in to comment.