diff --git a/cid/common.py b/cid/common.py index bd83d178..5ff9ddc8 100644 --- a/cid/common.py +++ b/cid/common.py @@ -362,9 +362,9 @@ def get_template_parameters(self, parameters: dict, param_prefix: str='', others try: res_list = self.athena.query(query) except (self.athena.client.exceptions.ClientError, CidError, CidCritical) as exc: - raise CidCritical(f'Failed fetching parameter {prefix}{key}: {exc}') from exc + raise CidCritical(f'Failed fetching parameter {prefix}{key}: {exc}.') from exc if not res_list: - raise CidCritical(f'Failed fetching parameter {prefix}{key}, {value}. Athena returns empty results') + raise CidCritical(f'Failed fetching parameter {prefix}{key}, {value}. Athena returns empty results. {value.get("error")}') elif len(res_list) == 1: params[key] = '-'.join(res_list[0]) else: diff --git a/dashboards/cora/cora.yaml b/dashboards/cora/cora.yaml index 62d19bae..af26f5df 100644 --- a/dashboards/cora/cora.yaml +++ b/dashboards/cora/cora.yaml @@ -6708,7 +6708,7 @@ datasets: RelationalTable: DataSourceArn: ${athena_datasource_arn} Catalog: AwsDataCatalog - Schema: ${athena_database_name} + Schema: ${account_map_database_name} Name: account_map InputColumns: - Name: account_id @@ -6719,7 +6719,7 @@ datasets: RelationalTable: DataSourceArn: ${athena_datasource_arn} Catalog: AwsDataCatalog - Schema: ${athena_database_name} + Schema: ${data_exports_database_name} Name: cora_view InputColumns: - Name: account_id @@ -6852,10 +6852,25 @@ datasets: - cora_view schedules: - default + parameters: + account_map_database_name: + type: athena + query: SELECT DISTINCT table_schema FROM information_schema.columns WHERE table_name = 'account_map' + error: You need to install Foundational Dashboards that provide account_map view. + default: cid_cur + description: Database of account_map table (from foundational dashboards) + global: True + data_exports_database_name: + type: athena + query: SELECT DISTINCT table_schema FROM information_schema.columns WHERE table_name = 'coh' + error: Please check if you have CID Data Exports installed and Cost Optimization Hub option is activated + default: cid_data_export + description: Database of cid data exports + global: True views: cora_view: data: |- - CREATE OR REPLACE VIEW "${athena_database_name}"."cora_view" AS + CREATE OR REPLACE VIEW "${data_exports_database_name}"."cora_view" AS SELECT "account_id" , "action_type" @@ -6891,6 +6906,8 @@ views: WHERE (CAST("date" AS date) >= ("date_trunc"('month', current_timestamp) - INTERVAL '6' MONTH)) parameters: data_exports_database_name: + type: athena + query: SELECT DISTINCT table_schema FROM information_schema.columns WHERE table_name = 'coh' default: cid_data_export description: Database of cid data exports global: True