DENG-3703 Update marketing main suppression list (#5544)
* DENG-3703 Update marketing main suppression list * update tests
This commit is contained in:
Родитель
ece2a59f8e
Коммит
62389f3aa5
|
@ -1,14 +0,0 @@
|
|||
friendly_name: Hard Bounces
|
||||
description: |-
|
||||
Braze Hard Bounces.
|
||||
Braze sends data in currents to GCS. These tables are build from those files.
|
||||
The tables are rebuild every day.
|
||||
owners:
|
||||
- leli@mozilla.com
|
||||
labels:
|
||||
incremental: false
|
||||
owner1: leli
|
||||
scheduling:
|
||||
dag_name: bqetl_braze_currents
|
||||
bigquery: null
|
||||
references: {}
|
|
@ -1,39 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
"""Load Braze current data from GCS."""
|
||||
|
||||
from argparse import ArgumentParser
|
||||
|
||||
from google.cloud import bigquery
|
||||
|
||||
parser = ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--project", default="moz-fx-data-shared-prod")
|
||||
parser.add_argument(
|
||||
"--source-bucket", default="moz-fx-data-marketing-prod-braze-firefox"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--source-prefix",
|
||||
default="currents/dataexport.prod-05.GCS.integration.65fdf55eea9932004d7fb071/event_type=users.messages.email.Bounce",
|
||||
)
|
||||
parser.add_argument("--destination_dataset", default="braze_external")
|
||||
parser.add_argument("--destination_table", default="hard_bounces_v1")
|
||||
|
||||
|
||||
def main():
|
||||
"""Load data from GCS into table."""
|
||||
args = parser.parse_args()
|
||||
client = bigquery.Client(args.project)
|
||||
|
||||
uri = f"gs://{args.source_bucket}/{args.source_prefix}/*"
|
||||
client.load_table_from_uri(
|
||||
uri,
|
||||
destination=f"{args.project}.{args.destination_dataset}.{args.destination_table}",
|
||||
job_config=bigquery.LoadJobConfig(
|
||||
write_disposition=bigquery.job.WriteDisposition.WRITE_TRUNCATE,
|
||||
source_format=bigquery.job.SourceFormat.AVRO,
|
||||
),
|
||||
).result()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -1,14 +0,0 @@
|
|||
friendly_name: Braze Unsubscribes
|
||||
description: |-
|
||||
Braze Unsubscribes.
|
||||
Braze sends data in currents to GCS. These tables are build from those files.
|
||||
The tables are rebuild every day.
|
||||
owners:
|
||||
- leli@mozilla.com
|
||||
labels:
|
||||
incremental: false
|
||||
owner1: leli
|
||||
scheduling:
|
||||
dag_name: bqetl_braze_currents
|
||||
bigquery: null
|
||||
references: {}
|
|
@ -1,39 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
"""Load Braze current data for unsubscribes in Braze from GCS into BigQuery."""
|
||||
|
||||
from argparse import ArgumentParser
|
||||
|
||||
from google.cloud import bigquery
|
||||
|
||||
parser = ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--project", default="moz-fx-data-shared-prod")
|
||||
parser.add_argument(
|
||||
"--source-bucket", default="moz-fx-data-marketing-prod-braze-firefox"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--source-prefix",
|
||||
default="currents/dataexport.prod-05.GCS.integration.65fdf55eea9932004d7fb071/event_type=users.messages.email.Unsubscribe",
|
||||
)
|
||||
parser.add_argument("--destination_dataset", default="braze_external")
|
||||
parser.add_argument("--destination_table", default="unsubscribes_v1")
|
||||
|
||||
|
||||
def main():
|
||||
"""Load data from GCS into table."""
|
||||
args = parser.parse_args()
|
||||
client = bigquery.Client(args.project)
|
||||
|
||||
uri = f"gs://{args.source_bucket}/{args.source_prefix}/*"
|
||||
client.load_table_from_uri(
|
||||
uri,
|
||||
destination=f"{args.project}.{args.destination_dataset}.{args.destination_table}",
|
||||
job_config=bigquery.LoadJobConfig(
|
||||
write_disposition=bigquery.job.WriteDisposition.WRITE_TRUNCATE,
|
||||
source_format=bigquery.job.SourceFormat.AVRO,
|
||||
),
|
||||
).result()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -7,24 +7,35 @@ WITH suppressions AS (
|
|||
"Acoustic" AS suppression_source,
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.acoustic_external.suppression_list_v1`
|
||||
-- braze unsubscribes
|
||||
-- braze unsubscribes from Firefox workspace
|
||||
UNION DISTINCT
|
||||
SELECT
|
||||
LOWER(email_address) AS email,
|
||||
TIMESTAMP_SECONDS(time) AS suppressed_timestamp,
|
||||
"clicked header" AS suppression_reason,
|
||||
"Braze unsubscribe" AS suppression_source
|
||||
"Braze Firefox unsubscribe" AS suppression_source
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.braze_external.unsubscribes_v1`
|
||||
-- braze hard bounces
|
||||
`moz-fx-data-shared-prod.braze_external.braze_currents_firefox_unsubscribe_v1`
|
||||
-- braze hard bounces from Firefox workspace
|
||||
UNION DISTINCT
|
||||
SELECT
|
||||
LOWER(email_address) AS email,
|
||||
TIMESTAMP_SECONDS(time) AS suppressed_timestamp,
|
||||
"hard bounce" AS suppression_reason,
|
||||
"Braze hard bounce" AS suppression_source
|
||||
"Braze Firefox hard bounce" AS suppression_source
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.braze_external.hard_bounces_v1`
|
||||
`moz-fx-data-shared-prod.braze_external.braze_currents_firefox_hard_bounces_v1`
|
||||
-- braze unsubscribes from Mozilla workspace
|
||||
-- TODO set this up once there are unsubscribes
|
||||
-- braze hard bounces from Mozilla workspace
|
||||
UNION DISTINCT
|
||||
SELECT
|
||||
LOWER(email_address) AS email,
|
||||
TIMESTAMP_SECONDS(time) AS suppressed_timestamp,
|
||||
"hard bounce" AS suppression_reason,
|
||||
"Braze Mozilla hard bounce" AS suppression_source
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.braze_external.braze_currents_mozilla_hard_bounces_v1`
|
||||
-- MoFo suppression List
|
||||
UNION DISTINCT
|
||||
SELECT
|
||||
|
|
|
@ -9,25 +9,30 @@
|
|||
- email: user2@email.com
|
||||
suppressed_timestamp: 2020-02-01 00:00:00+00:00
|
||||
suppression_source: Acoustic
|
||||
# User 3 Acoustic and braze unsubscribe and braze hard bounce
|
||||
# User 3 Acoustic and braze unsubscribe and braze firefox hard bounce
|
||||
- email: user3@email.com
|
||||
suppressed_timestamp: 2020-03-01 00:00:00+00:00
|
||||
suppression_source: Acoustic
|
||||
# User 4 Acoustic, braze unsubscribe, braze hard bounce and MoFo
|
||||
# User 4 Acoustic, braze unsubscribe, braze firefox hard bounce and MoFo
|
||||
- email: user4@email.com
|
||||
suppressed_timestamp: 2020-04-01 00:00:00+00:00
|
||||
suppression_source: Acoustic
|
||||
# User 5 braze unsubscribe
|
||||
# User 5 braze firefox unsubscribe
|
||||
- email: user5@email.com
|
||||
suppressed_timestamp: 2021-05-01 00:00:00+00:00
|
||||
suppression_reason: clicked header
|
||||
suppression_source: Braze unsubscribe
|
||||
# User 6 braze hard bounce
|
||||
suppression_source: Braze Firefox unsubscribe
|
||||
# User 6 braze Firefox hard bounce
|
||||
- email: user6@emil.com
|
||||
suppressed_timestamp: 2022-06-01 00:00:00+00:00
|
||||
suppression_reason: hard bounce
|
||||
suppression_source: Braze hard bounce
|
||||
suppression_source: Braze Firefox hard bounce
|
||||
# User 7 MoFo
|
||||
- email: user7@email.com
|
||||
suppressed_timestamp: 2023-07-01 00:00:00+00:00
|
||||
suppression_source: Campaign Monitor
|
||||
# User 8 braze Mozilla hard bounce
|
||||
- email: user8@emil.com
|
||||
suppressed_timestamp: 2024-08-01 00:00:00+00:00
|
||||
suppression_reason: hard bounce
|
||||
suppression_source: Braze Mozilla hard bounce
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# braze hard bounces
|
||||
# braze Firefox hard bounces
|
||||
---
|
||||
# User 1 only on Acoustic
|
||||
# User 2 Acoustic and braze unsubscribe
|
|
@ -0,0 +1,12 @@
|
|||
# expect
|
||||
---
|
||||
# User 1 only on Acoustic
|
||||
# User 2 Acoustic and braze unsubscribe
|
||||
# User 3 Acoustic and braze unsubscribe and braze firefox hard bounce
|
||||
# User 4 Acoustic, braze unsubscribe, braze firefox hard bounce and MoFo
|
||||
# User 5 braze firefox unsubscribe
|
||||
# User 6 braze Firefox hard bounce
|
||||
# User 7 MoFo
|
||||
# User 8 braze Mozilla hard bounce
|
||||
- email_address: user8@emil.com
|
||||
time: 1722470400
|
Загрузка…
Ссылка в новой задаче