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 @@ -92,3 +92,35 @@ resource "null_resource" "request_item_plan_status_failedreasoncode_column" {

depends_on = [null_resource.request_item_plan_status_templateid_column]
}

resource "null_resource" "request_item_plan_status_specificationid_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 specificationid string
EOT
}

depends_on = [null_resource.request_item_plan_status_templateid_column]
}

resource "null_resource" "request_item_plan_status_specificationbillingid_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 specificationbillingid string
EOT
}

depends_on = [null_resource.request_item_plan_status_templateid_column]
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ USING (
CAST(CAST(templates.suppliers AS json) AS map<varchar, varchar>)[LOWER(supplier)]
) AS templateid,
failedreasoncode,
CAST("$classification".timestamp AS BIGINT) AS timestamp
CAST("$classification".timestamp AS BIGINT) AS timestamp,
specificationid,
specificationbillingid
FROM ${source_table}
WHERE (sk LIKE 'REQUEST_ITEM_PLAN#%') AND
(
Expand Down Expand Up @@ -70,7 +72,9 @@ WHEN MATCHED AND (source.timestamp > target.timestamp) THEN UPDATE SET
recipientcontactid = source.recipientcontactid,
templateid = source.templateid,
failedreasoncode = source.failedreasoncode,
timestamp = source.timestamp
timestamp = source.timestamp,
specificationid = source.specificationid,
specificationbillingid = source.specificationbillingid
WHEN NOT MATCHED THEN INSERT (
clientid,
campaignid,
Expand All @@ -94,7 +98,9 @@ WHEN NOT MATCHED THEN INSERT (
recipientcontactid,
templateid,
failedreasoncode,
timestamp
timestamp,
specificationid,
specificationbillingid
)
VALUES (
source.clientid,
Expand All @@ -119,5 +125,7 @@ VALUES (
source.recipientcontactid,
source.templateid,
source.failedreasoncode,
source.timestamp
source.timestamp,
source.specificationid,
source.specificationbillingid
)
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ CREATE TABLE IF NOT EXISTS ${table_name} (
ordernumber int,
recipientcontactid string,
templateid string,
timestamp bigint
timestamp bigint,
specificationid string,
specificationbillingid string
)
PARTITIONED BY (bucket(32, clientid), month(createdtime), month(completedtime))
LOCATION '${s3_location}'
Expand Down
Loading