-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[COST-5137] Initial managed summary tasks rework (#5469)
* Initial managed summary tasks rework
- Loading branch information
Showing
38 changed files
with
636 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
...u/database/trino_sql/aws/openshift/managed_reporting_ocpawscostlineitem_daily_summary.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
-- insert managed table data into postgres table | ||
|
||
INSERT INTO postgres.{{schema | sqlsafe}}.reporting_ocpawscostlineitem_project_daily_summary_p ( | ||
uuid, | ||
report_period_id, | ||
cluster_id, | ||
cluster_alias, | ||
data_source, | ||
namespace, | ||
node, | ||
persistentvolumeclaim, | ||
persistentvolume, | ||
storageclass, | ||
resource_id, | ||
usage_start, | ||
usage_end, | ||
product_code, | ||
product_family, | ||
instance_type, | ||
cost_entry_bill_id, | ||
usage_account_id, | ||
account_alias_id, | ||
availability_zone, | ||
region, | ||
unit, | ||
usage_amount, | ||
infrastructure_data_in_gigabytes, | ||
infrastructure_data_out_gigabytes, | ||
data_transfer_direction, | ||
currency_code, | ||
unblended_cost, | ||
markup_cost, | ||
blended_cost, | ||
markup_cost_blended, | ||
savingsplan_effective_cost, | ||
markup_cost_savingsplan, | ||
calculated_amortized_cost, | ||
markup_cost_amortized, | ||
pod_cost, | ||
project_markup_cost, | ||
pod_labels, | ||
tags, | ||
aws_cost_category, | ||
cost_category_id, | ||
source_uuid | ||
) | ||
SELECT uuid(), | ||
{{report_period_id | sqlsafe}} as report_period_id, | ||
cluster_id, | ||
cluster_alias, | ||
data_source, | ||
namespace, | ||
node, | ||
persistentvolumeclaim, | ||
persistentvolume, | ||
storageclass, | ||
resource_id, | ||
date(usage_start), | ||
date(usage_end), | ||
product_code, | ||
product_family, | ||
instance_type, | ||
{{bill_id | sqlsafe}} as cost_entry_bill_id, | ||
usage_account_id, | ||
account_alias_id, | ||
availability_zone, | ||
region, | ||
unit, | ||
usage_amount, | ||
CASE | ||
WHEN upper(data_transfer_direction) = 'IN' THEN usage_amount | ||
ELSE 0 | ||
END AS infrastructure_data_in_gigabytes, | ||
CASE | ||
WHEN upper(data_transfer_direction) = 'OUT' THEN usage_amount | ||
ELSE 0 | ||
END AS infrastructure_data_out_gigabytes, | ||
data_transfer_direction, | ||
currency_code, | ||
unblended_cost, | ||
markup_cost, | ||
blended_cost, | ||
markup_cost_blended, | ||
savingsplan_effective_cost, | ||
markup_cost_savingsplan, | ||
calculated_amortized_cost, | ||
markup_cost_amortized, | ||
pod_cost, | ||
project_markup_cost, | ||
json_parse(pod_labels), | ||
json_parse(tags), | ||
json_parse(aws_cost_category), | ||
cost_category_id, | ||
cast(source as UUID) | ||
FROM hive.{{schema | sqlsafe}}.managed_reporting_ocpawscostlineitem_project_daily_summary | ||
WHERE source = {{aws_source_uuid}} | ||
AND ocp_source = {{ocp_source_uuid}} | ||
AND year = {{year}} | ||
AND lpad(month, 2, '0') = {{month}} -- Zero pad the month when fewer than 2 characters | ||
AND day IN {{days | inclause}} | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.