diff --git a/cid/builtin/core/data/queries/co/auto_scale.json b/cid/builtin/core/data/queries/co/auto_scale.json index b7547aba..ef48f2f1 100644 --- a/cid/builtin/core/data/queries/co/auto_scale.json +++ b/cid/builtin/core/data/queries/co/auto_scale.json @@ -1,7 +1,7 @@ { "DatabaseName": "${athena_database_name}", "TableInput": { - "Name": "${athenaTableName}", + "Name": "${athena_table_name}", "StorageDescriptor": { "Location": "${s3FolderPath}", "Columns": [ diff --git a/cid/builtin/core/data/queries/co/ebs_volume.json b/cid/builtin/core/data/queries/co/ebs_volume.json index de38b944..0f1a107a 100644 --- a/cid/builtin/core/data/queries/co/ebs_volume.json +++ b/cid/builtin/core/data/queries/co/ebs_volume.json @@ -1,7 +1,7 @@ { "DatabaseName": "${athena_database_name}", "TableInput": { - "Name": "${athenaTableName}", + "Name": "${athena_table_name}", "StorageDescriptor": { "Location": "${s3FolderPath}", "Columns": [ diff --git a/cid/builtin/core/data/queries/co/ec2_instance.json b/cid/builtin/core/data/queries/co/ec2_instance.json index 0a35c64f..79c39f7d 100644 --- a/cid/builtin/core/data/queries/co/ec2_instance.json +++ b/cid/builtin/core/data/queries/co/ec2_instance.json @@ -1,7 +1,7 @@ { "DatabaseName": "${athena_database_name}", "TableInput": { - "Name": "${athenaTableName}", + "Name": "${athena_table_name}", "StorageDescriptor": { "Location": "${s3FolderPath}", "Columns": [ diff --git a/cid/builtin/core/data/queries/co/lambda.json b/cid/builtin/core/data/queries/co/lambda.json index 642e3d52..3622cf25 100644 --- a/cid/builtin/core/data/queries/co/lambda.json +++ b/cid/builtin/core/data/queries/co/lambda.json @@ -1,7 +1,7 @@ { "DatabaseName": "${athena_database_name}", "TableInput": { - "Name": "${athenaTableName}", + "Name": "${athena_table_name}", "StorageDescriptor": { "Location": "${s3FolderPath}", "Columns": [ diff --git a/cid/builtin/core/data/queries/co/rds_database.json b/cid/builtin/core/data/queries/co/rds_database.json index a1af388d..6bf3d944 100644 --- a/cid/builtin/core/data/queries/co/rds_database.json +++ b/cid/builtin/core/data/queries/co/rds_database.json @@ -1,7 +1,7 @@ { "DatabaseName": "${athena_database_name}", "TableInput": { - "Name": "${athenaTableName}", + "Name": "${athena_table_name}", "StorageDescriptor": { "Location": "${s3FolderPath}", "Columns": [ diff --git a/cid/builtin/core/data/queries/shared/cur.yaml b/cid/builtin/core/data/queries/shared/cur.yaml index e059aa52..fd4bb535 100644 --- a/cid/builtin/core/data/queries/shared/cur.yaml +++ b/cid/builtin/core/data/queries/shared/cur.yaml @@ -1,6 +1,6 @@ DatabaseName: "${athena_database_name}" TableInput: - Name: "${athenaTableName}" + Name: "${athena_table_name}" Owner: owner Retention: 0 TableType: EXTERNAL_TABLE diff --git a/cid/builtin/core/data/queries/tao/glue_table.json b/cid/builtin/core/data/queries/tao/glue_table.json index 46d7aff6..e3f4696c 100644 --- a/cid/builtin/core/data/queries/tao/glue_table.json +++ b/cid/builtin/core/data/queries/tao/glue_table.json @@ -1,7 +1,7 @@ { "DatabaseName": "${athena_database_name}", "TableInput": { - "Name": "${athenaTableName}", + "Name": "${athena_table_name}", "StorageDescriptor": { "Location": "${s3FolderPath}", "Columns": [ diff --git a/cid/common.py b/cid/common.py index 5e41585e..ca377c19 100644 --- a/cid/common.py +++ b/cid/common.py @@ -1741,6 +1741,7 @@ def get_view_query(self, view_name: str) -> str: columns_tpl = { #'athena_datasource_arn': athena_datasource.arn, 'athena_database_name': self.athena.DatabaseName, + 'athena_table_name': view_name, 'cur_database': self.cur1.database if cur1_required else None, # for backward compatibly 'cur_table_name': self.cur1.table_name if cur1_required else None, # for backward compatibly 'cur1_database': self.cur1.database if cur1_required else None, diff --git a/cid/helpers/quicksight/__init__.py b/cid/helpers/quicksight/__init__.py index 3a292b0c..7832794c 100644 --- a/cid/helpers/quicksight/__init__.py +++ b/cid/helpers/quicksight/__init__.py @@ -261,22 +261,18 @@ def _safe_int(value, default=None): logger.info(f'Unable to describe template for {dashboardId}, {exc}') else: logger.info("Minimum template version could not be found for Dashboard {dashboardId}: {_template_arn}, deployed template could not be described") - - if _template_arn is None: + else: # Dashboard is not template based but definition based + try: + dashboard.deployedDefinition = self.describe_dashboard_definition(dashboard_id=dashboardId, refresh=refresh) + except CidError as exc: + logger.info('Exception on reading dashboard definition {dashboardId}: {exc}. Not critical. Continue.') + + if 'data' in _definition: # Resolve source definition (the latest definition publicly available) data_stream = io.StringIO(_definition["data"]) definition_data = yaml.safe_load(data_stream) dashboard.sourceDefinition = CidQsDefinition(definition_data) - # Resolve deployed dashboard definition - params = { - "dashboard_id": dashboardId, - "refresh": refresh - } - _deployed_definition = self.describe_dashboard_definition(**params) - # Assign property deployedDefinition to the retrieved dashboard definition - dashboard.deployedDefinition = _deployed_definition - # Fetch datasets (works for both TEMPLATE and DEFINITION based dashboards) for dataset in dashboard.version.get('DataSetArns', []): dataset_id = dataset.split('/')[-1]