Skip to content

Commit

Permalink
[COST-3892] split Identity/TimeInterval into start and end to have aw…
Browse files Browse the repository at this point in the history
…are timestamps for SUBS (#4609)
  • Loading branch information
cgoodfred authored Aug 3, 2023
1 parent b451f56 commit 2ba5684
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions koku/subs/subs_data_messenger.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def process_and_send_subs_message(self, upload_keys):
msg = self.build_subs_msg(
row["lineitem_resourceid"],
row["lineitem_usageaccountid"],
row["lineitem_usagestartdate"],
row["lineitem_usageenddate"],
row["subs_start_time"],
row["subs_end_time"],
row["product_vcpu"],
row["subs_sla"],
row["subs_usage"],
Expand Down
4 changes: 2 additions & 2 deletions koku/subs/test/test_subs_data_messenger.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def test_process_and_send_subs_message(self, mock_msg_builder, mock_reader, mock
upload_keys = ["fake_key"]
mock_reader.return_value = [
{
"lineitem_usagestartdate": "2023-07-01T01:00:00Z",
"lineitem_usageenddate": "2023-07-01T02:00:00Z",
"subs_start_time": "2023-07-01T01:00:00Z",
"subs_end_time": "2023-07-01T02:00:00Z",
"lineitem_resourceid": "i-55555556",
"lineitem_usageaccountid": "9999999999999",
"physical_cores": "1",
Expand Down
3 changes: 3 additions & 0 deletions koku/subs/trino_sql/aws_subs_summary.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
SELECT
*,
time_split[1] as subs_start_time,
time_split[2] as subs_end_time,
CASE lower(json_extract_scalar(tags, '$.com_redhat_rhel_variant'))
WHEN 'workstation' THEN 'Red Hat Enterprise Linux Workstation'
ELSE 'Red Hat Enterprise Linux Server'
Expand All @@ -22,6 +24,7 @@ SELECT
FROM
(
SELECT *,
split(identity_timeinterval, '/') as time_split,
cast(
transform_keys(
map_filter(
Expand Down

0 comments on commit 2ba5684

Please sign in to comment.