Skip to content
This repository was archived by the owner on Sep 12, 2024. It is now read-only.

Hotfix 864 #866

Merged
merged 3 commits into from
Mar 31, 2022
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
8 changes: 8 additions & 0 deletions chaos_genius/utils/metadata_api_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@
}
}

TABLE_VIEW_MATERIALIZED_VIEW_AVAILABILITY_THIRD_PARTY = {
"tables": True,
"views": False,
"materialized_views": False,
"supported_aggregations": ["mean", "sum", "count"],
"supports_multidim_dd": True,
}

SUPPORTED_DATASOURCES_FOR_MULTIDIM_DD = [
datasource
for datasource, conf in TABLE_VIEW_MATERIALIZED_VIEW_AVAILABILITY.items()
Expand Down
15 changes: 10 additions & 5 deletions chaos_genius/views/data_source_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
from chaos_genius.utils.metadata_api_config import (
SCHEMAS_AVAILABLE,
TABLE_VIEW_MATERIALIZED_VIEW_AVAILABILITY,
TABLE_VIEW_MATERIALIZED_VIEW_AVAILABILITY_THIRD_PARTY,
)

blueprint = Blueprint("api_data_source", __name__)
Expand Down Expand Up @@ -469,6 +470,7 @@ def check_views_availability():
schema_exist = False
message = ""
status = "failure"
supported_aggregations = []

try:
data = request.get_json()
Expand All @@ -486,12 +488,15 @@ def check_views_availability():
)

datasource_name = getattr(ds_data, "connection_type")
datasource_capability = (
TABLE_VIEW_MATERIALIZED_VIEW_AVAILABILITY_THIRD_PARTY
if ds_data.is_third_party
else TABLE_VIEW_MATERIALIZED_VIEW_AVAILABILITY[datasource_name]
)
schema_exist = SCHEMAS_AVAILABLE.get(datasource_name, False)
views = TABLE_VIEW_MATERIALIZED_VIEW_AVAILABILITY[datasource_name]["views"]
supported_aggregations = TABLE_VIEW_MATERIALIZED_VIEW_AVAILABILITY[datasource_name]["supported_aggregations"]
materialize_views = TABLE_VIEW_MATERIALIZED_VIEW_AVAILABILITY[
datasource_name
]["materialized_views"]
views = datasource_capability["views"]
supported_aggregations = datasource_capability["supported_aggregations"]
materialize_views = datasource_capability["materialized_views"]
status = "success"
except Exception as err:
message = "Error in fetching table info: {}".format(err)
Expand Down