Skip to content

Commit

Permalink
fix tao var name and definitions scan(#1007)
Browse files Browse the repository at this point in the history
  • Loading branch information
iakov-aws authored Nov 8, 2024
1 parent 3f8b4bf commit 53f6f72
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion cid/builtin/core/data/queries/co/auto_scale.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"DatabaseName": "${athena_database_name}",
"TableInput": {
"Name": "${athenaTableName}",
"Name": "${athena_table_name}",
"StorageDescriptor": {
"Location": "${s3FolderPath}",
"Columns": [
Expand Down
2 changes: 1 addition & 1 deletion cid/builtin/core/data/queries/co/ebs_volume.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"DatabaseName": "${athena_database_name}",
"TableInput": {
"Name": "${athenaTableName}",
"Name": "${athena_table_name}",
"StorageDescriptor": {
"Location": "${s3FolderPath}",
"Columns": [
Expand Down
2 changes: 1 addition & 1 deletion cid/builtin/core/data/queries/co/ec2_instance.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"DatabaseName": "${athena_database_name}",
"TableInput": {
"Name": "${athenaTableName}",
"Name": "${athena_table_name}",
"StorageDescriptor": {
"Location": "${s3FolderPath}",
"Columns": [
Expand Down
2 changes: 1 addition & 1 deletion cid/builtin/core/data/queries/co/lambda.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"DatabaseName": "${athena_database_name}",
"TableInput": {
"Name": "${athenaTableName}",
"Name": "${athena_table_name}",
"StorageDescriptor": {
"Location": "${s3FolderPath}",
"Columns": [
Expand Down
2 changes: 1 addition & 1 deletion cid/builtin/core/data/queries/co/rds_database.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"DatabaseName": "${athena_database_name}",
"TableInput": {
"Name": "${athenaTableName}",
"Name": "${athena_table_name}",
"StorageDescriptor": {
"Location": "${s3FolderPath}",
"Columns": [
Expand Down
2 changes: 1 addition & 1 deletion cid/builtin/core/data/queries/shared/cur.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
DatabaseName: "${athena_database_name}"
TableInput:
Name: "${athenaTableName}"
Name: "${athena_table_name}"
Owner: owner
Retention: 0
TableType: EXTERNAL_TABLE
Expand Down
2 changes: 1 addition & 1 deletion cid/builtin/core/data/queries/tao/glue_table.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"DatabaseName": "${athena_database_name}",
"TableInput": {
"Name": "${athenaTableName}",
"Name": "${athena_table_name}",
"StorageDescriptor": {
"Location": "${s3FolderPath}",
"Columns": [
Expand Down
1 change: 1 addition & 0 deletions cid/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
18 changes: 7 additions & 11 deletions cid/helpers/quicksight/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 53f6f72

Please sign in to comment.