Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,19 @@ resource "null_resource" "request_item_plan_status_recipientcontactid_column" {

depends_on = [null_resource.request_item_plan_status_ordernumber_column]
}

resource "null_resource" "request_item_plan_status_templateid_column" {
triggers = {
always_run = timestamp()
}
provisioner "local-exec" {
command = <<EOT
${path.module}/scripts/add_column.sh \
${aws_athena_workgroup.setup.name} \
${aws_glue_catalog_database.reporting.name} \
request_item_plan_status templateid string
EOT
}

depends_on = [null_resource.request_item_plan_status_recipientcontactid_column]
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ USING (
channeltype,
ordernumber,
recipientcontactid,
CAST(CAST(templates.suppliers AS json) AS map<varchar, varchar>)[LOWER(supplier)] AS templateid,
CAST("$classification".timestamp AS BIGINT) AS timestamp
FROM ${source_table}
WHERE (sk LIKE 'REQUEST_ITEM_PLAN#%') AND
Expand Down Expand Up @@ -63,6 +64,7 @@ WHEN MATCHED AND (source.timestamp > target.timestamp) THEN UPDATE SET
channeltype = source.channeltype,
ordernumber = source.ordernumber,
recipientcontactid = source.recipientcontactid,
templateid = source.templateid,
timestamp = source.timestamp
WHEN NOT MATCHED THEN INSERT (
clientid,
Expand All @@ -85,6 +87,7 @@ WHEN NOT MATCHED THEN INSERT (
channeltype,
ordernumber,
recipientcontactid,
templateid,
timestamp
)
VALUES (
Expand All @@ -108,5 +111,6 @@ VALUES (
source.channeltype,
source.ordernumber,
source.recipientcontactid,
source.templateid,
source.timestamp
)
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ SELECT
requestitemplanstatus,
communicationtype,
channeltype,
requestitemplanfailedreason
requestitemplanfailedreason,
templateid
FROM completed_comms
WHERE clientid = ? AND requestid = ?
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ SELECT
requestitemplanstatus,
communicationtype,
channeltype,
requestitemplanfailedreason
requestitemplanfailedreason,
templateid
FROM completed_comms
WHERE
clientid = ? AND
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ CREATE TABLE IF NOT EXISTS ${table_name} (
channeltype string,
ordernumber int,
recipientcontactid string,
templateid string,
timestamp bigint
)
PARTITIONED BY (bucket(32, clientid), month(createdtime), month(completedtime))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ SELECT
rip.status as requestitemplanstatus,
rip.communicationtype as communicationtype,
rip.channeltype as channeltype,
rip.failedreason as requestitemplanfailedreason
rip.failedreason as requestitemplanfailedreason,
rip.templateid as templateid
FROM request_item_status ri
LEFT OUTER JOIN request_item_plan_status rip ON
ri.requestitemid = rip.requestitemid AND
Expand Down
Loading