mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-23 00:28:03 +00:00
fix(ingest): looker - pass transport options to all api calls (#5417)
This commit is contained in:
parent
f387fa6149
commit
e6ce4324c9
@ -1053,7 +1053,11 @@ class LookerDashboardSource(Source):
|
|||||||
|
|
||||||
def _populate_userwise_runs_counts(self, dashboard_usages):
|
def _populate_userwise_runs_counts(self, dashboard_usages):
|
||||||
userwise_count_rows = LookerUtil.run_inline_query(
|
userwise_count_rows = LookerUtil.run_inline_query(
|
||||||
self.client, usage_queries["counts_per_day_per_user_per_dashboard"]
|
self.client,
|
||||||
|
usage_queries["counts_per_day_per_user_per_dashboard"],
|
||||||
|
transport_options=self.source_config.transport_options.get_transport_options()
|
||||||
|
if self.source_config.transport_options is not None
|
||||||
|
else None,
|
||||||
)
|
)
|
||||||
|
|
||||||
for row in userwise_count_rows:
|
for row in userwise_count_rows:
|
||||||
@ -1108,6 +1112,9 @@ class LookerDashboardSource(Source):
|
|||||||
count_rows = LookerUtil.run_inline_query(
|
count_rows = LookerUtil.run_inline_query(
|
||||||
self.client,
|
self.client,
|
||||||
usage_queries["counts_per_day_per_dashboard"],
|
usage_queries["counts_per_day_per_dashboard"],
|
||||||
|
transport_options=self.source_config.transport_options.get_transport_options()
|
||||||
|
if self.source_config.transport_options is not None
|
||||||
|
else None,
|
||||||
)
|
)
|
||||||
for row in count_rows:
|
for row in count_rows:
|
||||||
dashboard_usages[
|
dashboard_usages[
|
||||||
|
@ -476,11 +476,14 @@ class LookerUtil:
|
|||||||
)
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run_inline_query(client: Looker31SDK, q: dict) -> List:
|
def run_inline_query(
|
||||||
|
client: Looker31SDK, q: dict, transport_options: Optional[TransportOptions]
|
||||||
|
) -> List:
|
||||||
|
|
||||||
response_sql = client.run_inline_query(
|
response_sql = client.run_inline_query(
|
||||||
result_format="sql",
|
result_format="sql",
|
||||||
body=LookerUtil.create_query_request(q),
|
body=LookerUtil.create_query_request(q),
|
||||||
|
transport_options=transport_options,
|
||||||
)
|
)
|
||||||
logger.debug("=================Query=================")
|
logger.debug("=================Query=================")
|
||||||
logger.debug(response_sql)
|
logger.debug(response_sql)
|
||||||
@ -488,6 +491,7 @@ class LookerUtil:
|
|||||||
response_json = client.run_inline_query(
|
response_json = client.run_inline_query(
|
||||||
result_format="json",
|
result_format="json",
|
||||||
body=LookerUtil.create_query_request(q),
|
body=LookerUtil.create_query_request(q),
|
||||||
|
transport_options=transport_options,
|
||||||
)
|
)
|
||||||
|
|
||||||
logger.debug("=================Response=================")
|
logger.debug("=================Response=================")
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from typing import Optional
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
from freezegun import freeze_time
|
from freezegun import freeze_time
|
||||||
|
from looker_sdk.rtl.transport import TransportOptions
|
||||||
from looker_sdk.sdk.api31.models import (
|
from looker_sdk.sdk.api31.models import (
|
||||||
Dashboard,
|
Dashboard,
|
||||||
DashboardElement,
|
DashboardElement,
|
||||||
@ -294,7 +296,9 @@ def setup_mock_user(mocked_client):
|
|||||||
mocked_client.user.return_value = User(id=1, email="test@looker.com")
|
mocked_client.user.return_value = User(id=1, email="test@looker.com")
|
||||||
|
|
||||||
|
|
||||||
def side_effect_query_inline(result_format: str, body: WriteQuery) -> str:
|
def side_effect_query_inline(
|
||||||
|
result_format: str, body: WriteQuery, transport_options: Optional[TransportOptions]
|
||||||
|
) -> str:
|
||||||
query_type = None
|
query_type = None
|
||||||
if result_format == "sql":
|
if result_format == "sql":
|
||||||
return "" # Placeholder for sql text
|
return "" # Placeholder for sql text
|
||||||
|
Loading…
x
Reference in New Issue
Block a user