Skip to content

Commit

Permalink
fix extended support cur2 query
Browse files Browse the repository at this point in the history
  • Loading branch information
work-bw authored Nov 15, 2024
1 parent 4c05956 commit 26b7df6
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3610,7 +3610,7 @@ views:
- product['deployment_option']
- product['instance_type']
- product['instance_type_family']
- product['product_family']
- product_product_family
- product['region']
- product['vcpu']
data: |-
Expand Down Expand Up @@ -3800,14 +3800,14 @@ views:
, accmap.account_name
, c.product['region'] region_code
, (CASE WHEN (c.product['database_engine'] LIKE 'Aurora%') THEN 'Aurora' ELSE 'AmazonRDS' END) rds_type
, (CASE WHEN (c.line_item_usage_type LIKE '%InstanceUsage%') THEN 'SINGLE-AZ' WHEN (c.line_item_usage_type LIKE '%Multi-AZUsage%') THEN 'MULTI-AZ' WHEN (c.line_item_usage_type LIKE '%Multi-AZClusterUsage%') THEN 'MULTI-AZ-CLUSTER' WHEN ((c.product['product_family'] = 'Serverless') AND (c.line_item_usage_type like '%Aurora:Serverless%Usage')) THEN 'SERVERLESS' WHEN ((c.product['product_family'] = 'ServerlessV2') AND (c.line_item_usage_type like '%Aurora:ServerlessV2%Usage')) THEN 'SERVERLESSV2' ELSE 'UNDEFINED (Check the usage type)' END) deployment_option
, (CASE WHEN (c.line_item_usage_type LIKE '%InstanceUsage%') THEN 'SINGLE-AZ' WHEN (c.line_item_usage_type LIKE '%Multi-AZUsage%') THEN 'MULTI-AZ' WHEN (c.line_item_usage_type LIKE '%Multi-AZClusterUsage%') THEN 'MULTI-AZ-CLUSTER' WHEN ((c.product_product_family = 'Serverless') AND (c.line_item_usage_type like '%Aurora:Serverless%Usage')) THEN 'SERVERLESS' WHEN ((c.product_product_family = 'ServerlessV2') AND (c.line_item_usage_type like '%Aurora:ServerlessV2%Usage')) THEN 'SERVERLESSV2' ELSE 'UNDEFINED (Check the usage type)' END) deployment_option
, (CASE WHEN (rdsu.engine IS NOT NULL) THEN rdsu.engine ELSE c.product['database_engine'] END) engine
, (CASE WHEN ((rdsu.engine IS NOT NULL) AND (rdsu.engineversion IS NOT NULL)) THEN CONCAT(rdsu.engine, rdsu.engineversion) ELSE 'engine-1.-1.-1' END) engineversion
, c.product['instance_type_family'] instance_type_family
, c.product['instance_type'] instance_type
, c.line_item_line_item_description item_description
, (CASE WHEN ((c.product['product_family'] like 'Serverless%') AND (c.line_item_usage_type like '%Aurora:Serverless%Usage')) THEN 0 ELSE CAST(c.product['vcpu'] AS int) END) vcpus
, (CASE WHEN ((c.product['product_family'] = 'ServerlessV2') AND (c.line_item_usage_type like '%Aurora:ServerlessV2%Usage')) THEN 'acu-hour' ELSE 'vcpu-hour' END) usage_unit
, (CASE WHEN ((c.product_product_family like 'Serverless%') AND (c.line_item_usage_type like '%Aurora:Serverless%Usage')) THEN 0 ELSE CAST(c.product['vcpu'] AS int) END) vcpus
, (CASE WHEN ((c.product_product_family = 'ServerlessV2') AND (c.line_item_usage_type like '%Aurora:ServerlessV2%Usage')) THEN 'acu-hour' ELSE 'vcpu-hour' END) usage_unit
, split_part(c.line_item_resource_id, ':', 7) dbresourceidentifier
, c.line_item_resource_id resource_id
, c.product['deployment_option'] original_deployment_option
Expand All @@ -3818,7 +3818,7 @@ views:
(("${cur2_database}"."${cur2_table_name}" c
INNER JOIN all_sanitised_rds_resources rdsu ON ((c.bill_payer_account_id = rdsu.payer_id) AND (c.line_item_usage_account_id = rdsu.accountid) AND (c.product['region'] = rdsu.region) AND (split_part(c.line_item_resource_id, ':', 7) = rdsu.dbresourceidentifier)))
INNER JOIN account_map accmap ON (c.line_item_usage_account_id = accmap.account_id))
WHERE (((c.bill_billing_period_start_date >= (date_trunc('month', current_timestamp) - INTERVAL '4' MONTH)) AND (CAST(concat(c.billing_period, '-01') AS date) >= (date_trunc('month', current_date) - INTERVAL '4' MONTH))) AND (c.product_servicecode = 'AmazonRDS') AND (c.line_item_line_item_type IN ('DiscountedUsage', 'Usage')) AND ((c.product['product_family'] = 'Database Instance') OR ((c.product['product_family'] like 'Serverless%') AND (c.line_item_usage_type like '%Aurora:Serverless%Usage'))))
WHERE (((c.bill_billing_period_start_date >= (date_trunc('month', current_timestamp) - INTERVAL '4' MONTH)) AND (CAST(concat(c.billing_period, '-01') AS date) >= (date_trunc('month', current_date) - INTERVAL '4' MONTH))) AND (c.product_servicecode = 'AmazonRDS') AND (c.line_item_line_item_type IN ('DiscountedUsage', 'Usage')) AND ((c.product_product_family = 'Database Instance') OR ((c.product_product_family like 'Serverless%') AND (c.line_item_usage_type like '%Aurora:Serverless%Usage'))))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19
)
SELECT
Expand Down

0 comments on commit 26b7df6

Please sign in to comment.