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

QuickSight crawler unsupported dataset type [sc-30088] #1059

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
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
42 changes: 30 additions & 12 deletions metaphor/quick_sight/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
from pydantic.dataclasses import dataclass

from metaphor.common.aws import AwsCredentials
from metaphor.common.logger import json_dump_to_debug_file
from metaphor.common.logger import get_logger, json_dump_to_debug_file
from metaphor.quick_sight.models import Dashboard, DataSet, DataSource, ResourceType

logger = get_logger()


def create_quick_sight_client(aws: AwsCredentials) -> boto3.client:
return aws.get_session().client("quicksight")
Expand Down Expand Up @@ -52,22 +54,29 @@ def _get_resource_ids(self, endpoint: Endpoint) -> List[str]:
paginator = self._client.get_paginator(endpoint.value)
paginator_response = paginator.paginate(AwsAccountId=self._aws_account_id)

results = []
ids = []
settings = ENDPOINT_SETTING[endpoint]
for page in paginator_response:
for item in page[settings.list_key]:
results.append(item)
ids.append(item[settings.item_key])

json_dump_to_debug_file(results, f"{endpoint.value}.json")
return ids

def _get_dataset_detail(self) -> None:
results = []
for dataset_id in self._get_resource_ids(Endpoint.list_data_sets):
result = self._client.describe_data_set(
AwsAccountId=self._aws_account_id, DataSetId=dataset_id
)
try:
result = self._client.describe_data_set(
AwsAccountId=self._aws_account_id, DataSetId=dataset_id
)
except Exception as e:
logger.error(f"Error getting dataset {dataset_id}: {e}")
continue

results.append(result)

dataset = DataSet(**(result["DataSet"]))

if dataset.Arn is None:
Expand All @@ -80,9 +89,14 @@ def _get_dataset_detail(self) -> None:
def _get_dashboard_detail(self):
results = []
for dashboard_id in self._get_resource_ids(Endpoint.list_dashboards):
result = self._client.describe_dashboard(
AwsAccountId=self._aws_account_id, DashboardId=dashboard_id
)
try:
result = self._client.describe_dashboard(
AwsAccountId=self._aws_account_id, DashboardId=dashboard_id
)
except Exception as e:
logger.error(f"Error getting dashboard {dashboard_id}: {e}")
continue

results.append(result)
dashboard = Dashboard(**(result["Dashboard"]))

Expand All @@ -96,11 +110,15 @@ def _get_dashboard_detail(self):
def _get_data_source_detail(self):
results = []
for data_source_id in self._get_resource_ids(Endpoint.list_data_sources):
result = self._client.describe_data_source(
AwsAccountId=self._aws_account_id, DataSourceId=data_source_id
)
results.append(result)
try:
result = self._client.describe_data_source(
AwsAccountId=self._aws_account_id, DataSourceId=data_source_id
)
except Exception as e:
logger.error(f"Error getting data source {data_source_id}: {e}")
continue

results.append(result)
data_source = DataSource(**(result["DataSource"]))

if data_source.Arn is None:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "metaphor-connectors"
version = "0.14.169"
version = "0.14.170"
license = "Apache-2.0"
description = "A collection of Python-based 'connectors' that extract metadata from various sources to ingest into the Metaphor app."
authors = ["Metaphor <dev@metaphor.io>"]
Expand Down
Loading