Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DS-3326] Add state to subplat subscriptions v2 #5836

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

BenWu
Copy link
Contributor

@BenWu BenWu commented Jun 25, 2024

DS-3326

This adds state for US and Canada to derived stripe customer and downstream subscription tables

I tested this by changing the project qualifiers and deploying/running in a sandbox project. The results look fine on a cursory look

Checklist for reviewer:

  • Commits should reference a bug or github issue, if relevant (if a bug is referenced, the pull request should include the bug number in the title).
  • If the PR comes from a fork, trigger integration CI tests by running the Push to upstream workflow and provide the <username>:<branch> of the fork as parameter. The parameter will also show up
    in the logs of the manual-trigger-required-for-fork CI task together with more detailed instructions.
  • If adding a new field to a query, ensure that the schema and dependent downstream schemas have been updated.
  • When adding a new derived dataset, ensure that data is not available already (fully or partially) and recommend extending an existing dataset in favor of creating new ones. Data can be available in the bigquery-etl repository, looker-hub or in looker-spoke-default.

For modifications to schemas in restricted namespaces (see CODEOWNERS):

┆Issue is synchronized with this Jira Task

@dataops-ci-bot

This comment has been minimized.

Copy link
Contributor

@sean-rose sean-rose left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main thing we want to do for DS-3326 is include the US/Canadian states for subscriptions in the newer SubPlat ETLs:

@dataops-ci-bot

This comment has been minimized.

@dataops-ci-bot

This comment has been minimized.

@dataops-ci-bot

This comment has been minimized.

Copy link
Contributor Author

@BenWu BenWu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sean-rose I think I've covered the necessary tables so ready for review. I left some questions as well

@@ -51,6 +51,9 @@ fields:
- name: country_name
type: STRING
mode: NULLABLE
- name: country_state_code
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somewhat awkwardly named because I don't want it to be ambiguous and interpreted as the state of a subscription

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's less than ideal either way, but personally I'd lean toward naming these state_code and we can clarify the meaning in the column description (FYI "status" is the term being used elsewhere in the ETLs for the state/status of a subscription).

Also, even when the other columns don't have descriptions please go ahead and add descriptions for these columns being added, as we should consistently clarify the meaning of the column and note that it's only populated for the US and Canada.

@@ -8,7 +8,7 @@ description: |-

This table's schema closely mirrors Stripe's customers API (https://stripe.com/docs/api/customers/object).
Fields which Fivetran doesn't sync and fields we've specifically chosen not to include (e.g. PII) have been omitted.
In particular, all address fields except country have been omitted because Firefox Account user IDs are present and this is in a Mozilla-confidential dataset.
In particular, postal codes have been omitted from address because Firefox Account user IDs are present and this is in a Mozilla-confidential dataset.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this line still relevant? From what I can tell, the source tables are moz-confidential

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this line still relevant?

Yes, it's still relevant, and I'd recommend saying "all address fields except country and state have been omitted", because it's referring to not just what's omitted in the ETL but also what's omitted from the Fivetran sync (e.g. we've configured Fivetran to not sync street addresses).

Suggested change
In particular, postal codes have been omitted from address because Firefox Account user IDs are present and this is in a Mozilla-confidential dataset.
In particular, all address fields except country and state have been omitted because Firefox Account user IDs are present and this is in a Mozilla-confidential dataset.

(the same applies to similar changes made in other metadata.yaml files)

From what I can tell, the source tables are moz-confidential

The ultimate source tables for these ETLs are in moz-fx-data-shared-prod.stripe_external and moz-fx-data-bq-fivetran.stripe, which aren't Moz-confidential.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok I saw that the redash service account had access to stripe_external so I assumed it was accessible from stmo but that role doesn't include data viewer permissions. I also didn't see that data platform group has special access

Comment on lines +113 to +114
-- charges usually have postal code and are sometimes associated with
-- a card that does not have a state or postal code
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know enough about relationship between cards and charges to know if this is safe to do but I thought I'd add this here so it's easier to dicuss. From the cards that have postal codes, they almost always match the the one in the charge.
e.g. this returns two distinct cards

SELECT 
  charge.id,
  card.id,
  charge.billing_detail_address_postal_code,
  card.address_zip,
FROM
  `moz-fx-data-shared-prod.stripe_external.charge_v1` AS charge
LEFT JOIN
  `moz-fx-data-shared-prod.stripe_external.card_v1` AS card
ON
  (card.id = charge.card_id)
WHERE
  charge.billing_detail_address_postal_code != card.address_zip

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine, but I'd prioritize the charge's address over the card's address in COALESCE(...) AS latest_card_state, since the charge presumably has the more up-to-date postal code.

And since there have been no cases thus far where a card has a postal code and an associated charge does not, you could opt to ignore the card postal codes and just use the charge postal codes (which is what I did in stripe_subscriptions_history_v1).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I didn't notice that the other table was already using charges. I'll remove the card one

history.subscription.status AS provider_status,
history.subscription_first_active_at AS started_at,
history.subscription.ended_at,
(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mostly whitespace so using the hide whitespace option will make this easier to read

@BenWu BenWu marked this pull request as ready for review June 28, 2024 15:58
@BenWu BenWu requested a review from sean-rose June 28, 2024 15:58
@BenWu BenWu changed the title [DS-3326] Update stripe subs to match location hierarchy for states [DS-3326] Add state to subplat subscriptions v2 Jun 28, 2024
@dataops-ci-bot

This comment has been minimized.

@@ -51,6 +51,9 @@ fields:
- name: country_name
type: STRING
mode: NULLABLE
- name: country_state_code
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's less than ideal either way, but personally I'd lean toward naming these state_code and we can clarify the meaning in the column description (FYI "status" is the term being used elsewhere in the ETLs for the state/status of a subscription).

Also, even when the other columns don't have descriptions please go ahead and add descriptions for these columns being added, as we should consistently clarify the meaning of the column and note that it's only populated for the US and Canada.

@@ -8,7 +8,7 @@ description: |-

This table's schema closely mirrors Stripe's customers API (https://stripe.com/docs/api/customers/object).
Fields which Fivetran doesn't sync and fields we've specifically chosen not to include (e.g. PII) have been omitted.
In particular, all address fields except country have been omitted because Firefox Account user IDs are present and this is in a Mozilla-confidential dataset.
In particular, postal codes have been omitted from address because Firefox Account user IDs are present and this is in a Mozilla-confidential dataset.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this line still relevant?

Yes, it's still relevant, and I'd recommend saying "all address fields except country and state have been omitted", because it's referring to not just what's omitted in the ETL but also what's omitted from the Fivetran sync (e.g. we've configured Fivetran to not sync street addresses).

Suggested change
In particular, postal codes have been omitted from address because Firefox Account user IDs are present and this is in a Mozilla-confidential dataset.
In particular, all address fields except country and state have been omitted because Firefox Account user IDs are present and this is in a Mozilla-confidential dataset.

(the same applies to similar changes made in other metadata.yaml files)

From what I can tell, the source tables are moz-confidential

The ultimate source tables for these ETLs are in moz-fx-data-shared-prod.stripe_external and moz-fx-data-bq-fivetran.stripe, which aren't Moz-confidential.

- name: state
type: STRING
mode: NULLABLE
description: Two-letter state/province code (only for US and CA).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • This statement isn't entirely true as we aren't enforcing that they be two-letter codes, but I feel like we should, since the non-two-letter values generally look to be ones we don't want. I'll add suggestions in the relevant ETLs for how I think that should be done.
  • I'd suggest spelling out "Canada" here and in other descriptions/comments to remove ambiguity (those of us in the US tend to most associate "CA" with California as that's its state code).

IF(
customer.address.country IN ("US", "CA"),
COALESCE(
NULLIF(customer.address.state, ""),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
NULLIF(customer.address.state, ""),
IF(LENGTH(customer.address.state) = 2, customer.address.state, NULL)

A relevant comment when I added equivalent logic for US & Canadian state codes in the older VPN ETLs:

Most billing address state values for US and Canadian customers are two-letter codes, but there are some with state names instead, including some which are clearly not US/Canadian states. So although this excludes somewhat legit values like "Colorado" for a few customers, I felt it was worth it to exclude clearly wrong values like "Bayamón" and keep the data consistent for BI.

IF(
customer.shipping.address.country IN ("US", "CA"),
COALESCE(
NULLIF(customer.shipping.address.state, ""),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
NULLIF(customer.shipping.address.state, ""),
IF(LENGTH(customer.shipping.address.state) = 2, customer.shipping.address.state, NULL)

While this isn't technically required at the moment since all existing customer shipping address state values for the US and Canada are two-letter codes like we want, I figure it's wise to guard against non-two-letter values possibly appearing in the future.

Comment on lines 75 to 77
-- Prefer charges that succeeded and non-null country
IF(charges.status = 'succeeded', 1, 2),
cards.country DESC NULLS LAST,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The country-not-null prioritization should be done first, and we don't want to actually sort by the non-null country values.

Suggested change
-- Prefer charges that succeeded and non-null country
IF(charges.status = 'succeeded', 1, 2),
cards.country DESC NULLS LAST,
-- Prefer non-null country and charges that succeeded.
IF(cards.country IS NOT NULL, 1, 2),
IF(charges.status = 'succeeded', 1, 2),

Technically this still wouldn't be exactly equivalent to cards.country IGNORE NULLS, as it could select a row with a null cards.country value. Luckily, due to how the state code joins have conditions on non-null cards.country values the latest_card_state value is guaranteed to also be null in that case, so it wouldn't actually produce incorrect results.

To be exactly equivalent to cards.country IGNORE NULLS you'd have to do something like this:

    ARRAY_AGG(
      IF(
        cards.country IS NOT NULL,
        STRUCT(
          cards.country AS latest_card_country,
          COALESCE(
            card_us_zip.state_code,
            card_ca_post.province_code,
            charge_us_zip.state_code,
            charge_ca_post.province_code
          ) AS latest_card_state
        ),
        NULL
      ) IGNORE NULLS
      ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the sql I was looking for. I didn't think to make the whole struct null

Comment on lines +113 to +114
-- charges usually have postal code and are sometimes associated with
-- a card that does not have a state or postal code
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine, but I'd prioritize the charge's address over the card's address in COALESCE(...) AS latest_card_state, since the charge presumably has the more up-to-date postal code.

And since there have been no cases thus far where a card has a postal code and an associated charge does not, you could opt to ignore the card postal codes and just use the charge postal codes (which is what I did in stripe_subscriptions_history_v1).

Comment on lines 184 to 190
THEN STRUCT(
NULLIF(history.subscription.customer.shipping.address.country, '') AS country_code,
NULLIF(
history.subscription.customer.shipping.address.state,
''
) AS country_state_code
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should use the customer's (billing) address, not their shipping address, and we don't need to apply NULLIF(..., '') to the state value since that's already done in stripe_customers_revised_changelog_v1.

Suggested change
THEN STRUCT(
NULLIF(history.subscription.customer.shipping.address.country, '') AS country_code,
NULLIF(
history.subscription.customer.shipping.address.state,
''
) AS country_state_code
)
THEN STRUCT(
NULLIF(history.subscription.customer.address.country, '') AS country_code,
history.subscription.customer.address.state AS country_state_code
)

Speaking of which, it occurs to me that if you changed stripe_customers_revised_changelog_v1 to also apply NULLIF(..., '') to the country values there, then the repetitive NULLIF(..., '') logic for country values in this ETL could be removed.

charge_summaries.latest_card_state AS country_state_code
)
END
-- SubPlat copies the PayPal billing agreement country to the customer's address.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
-- SubPlat copies the PayPal billing agreement country to the customer's address.
-- SubPlat copied the PayPal billing agreement country to the customer's address before we enabled Stripe Tax (FXA-5457).

To match the equivalent comment in stripe_subscriptions_history_v1.

@BenWu BenWu requested a review from sean-rose June 28, 2024 21:52
@dataops-ci-bot

This comment has been minimized.

Copy link
Contributor

@sean-rose sean-rose left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+wc

-- Limit address data to country and state since the metadata includes FxA user IDs
-- and this is in a Mozilla-confidential dataset. State is only for US and Canada.
STRUCT(
NULLIF(customer.address.country, ""),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
NULLIF(customer.address.country, ""),
NULLIF(customer.address.country, "") AS country,

customer.shipping.* REPLACE (STRUCT(customer.shipping.address.country) AS address)
customer.shipping.* REPLACE (
STRUCT(
NULLIF(customer.shipping.address.country, ""),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
NULLIF(customer.shipping.address.country, ""),
NULLIF(customer.shipping.address.country, "") AS country,

Comment on lines 70 to 71
LIMIT
1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend leaving LIMIT 1 in. While it isn't technically required, I believe it does help a bit with performance since BigQuery can just keep a single record per aggregation rather than aggregating them all and only using one.

@dataops-ci-bot
Copy link

Integration report for "🧹"

sql.diff

Click to expand!
Only in /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/monitoring/event_monitoring_live: schema.yaml
Only in /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/search_derived/mobile_search_aggregates_v1: backfill.yaml
Only in /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/search_derived/search_aggregates_v8: backfill.yaml
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/contextual_services/event_aggregates/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/contextual_services/event_aggregates/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/contextual_services/event_aggregates/schema.yaml	2024-06-28 22:15:57.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/contextual_services/event_aggregates/schema.yaml	2024-06-28 22:23:13.000000000 +0000
@@ -1,49 +1,49 @@
 fields:
-- mode: NULLABLE
-  name: submission_date
+- name: submission_date
   type: DATE
-- mode: NULLABLE
-  name: source
+  mode: NULLABLE
+- name: source
   type: STRING
-- mode: NULLABLE
-  name: event_type
+  mode: NULLABLE
+- name: event_type
   type: STRING
-- mode: NULLABLE
-  name: form_factor
+  mode: NULLABLE
+- name: form_factor
   type: STRING
-- mode: NULLABLE
-  name: country
+  mode: NULLABLE
+- name: country
   type: STRING
-- mode: NULLABLE
-  name: subdivision1
+  mode: NULLABLE
+- name: subdivision1
   type: STRING
-- mode: NULLABLE
-  name: advertiser
+  mode: NULLABLE
+- name: advertiser
   type: STRING
-- mode: NULLABLE
-  name: release_channel
+  mode: NULLABLE
+- name: release_channel
   type: STRING
-- mode: NULLABLE
-  name: position
+  mode: NULLABLE
+- name: position
   type: INTEGER
-- mode: NULLABLE
-  name: provider
+  mode: NULLABLE
+- name: provider
   type: STRING
-- mode: NULLABLE
-  name: match_type
+  mode: NULLABLE
+- name: match_type
   type: STRING
-- mode: NULLABLE
-  name: normalized_os
+  mode: NULLABLE
+- name: normalized_os
   type: STRING
-- mode: NULLABLE
-  name: suggest_data_sharing_enabled
+  mode: NULLABLE
+- name: suggest_data_sharing_enabled
   type: BOOLEAN
-- mode: NULLABLE
-  name: event_count
+  mode: NULLABLE
+- name: event_count
   type: INTEGER
-- mode: NULLABLE
-  name: user_count
+  mode: NULLABLE
+- name: user_count
   type: INTEGER
-- mode: NULLABLE
-  name: query_type
+  mode: NULLABLE
+- name: query_type
   type: STRING
+  mode: NULLABLE
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/contextual_services/event_aggregates_suggest/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/contextual_services/event_aggregates_suggest/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/contextual_services/event_aggregates_suggest/schema.yaml	2024-06-28 22:15:57.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/contextual_services/event_aggregates_suggest/schema.yaml	2024-06-28 22:23:13.000000000 +0000
@@ -1,40 +1,40 @@
 fields:
-- mode: NULLABLE
-  name: submission_date
+- name: submission_date
   type: DATE
-- mode: NULLABLE
-  name: form_factor
+  mode: NULLABLE
+- name: form_factor
   type: STRING
-- mode: NULLABLE
-  name: country
+  mode: NULLABLE
+- name: country
   type: STRING
-- mode: NULLABLE
-  name: advertiser
+  mode: NULLABLE
+- name: advertiser
   type: STRING
-- mode: NULLABLE
-  name: normalized_os
+  mode: NULLABLE
+- name: normalized_os
   type: STRING
-- mode: NULLABLE
-  name: release_channel
+  mode: NULLABLE
+- name: release_channel
   type: STRING
-- mode: NULLABLE
-  name: position
+  mode: NULLABLE
+- name: position
   type: INTEGER
-- mode: NULLABLE
-  name: provider
+  mode: NULLABLE
+- name: provider
   type: STRING
-- mode: NULLABLE
-  name: match_type
+  mode: NULLABLE
+- name: match_type
   type: STRING
-- mode: NULLABLE
-  name: suggest_data_sharing_enabled
+  mode: NULLABLE
+- name: suggest_data_sharing_enabled
   type: BOOLEAN
-- mode: NULLABLE
-  name: impression_count
+  mode: NULLABLE
+- name: impression_count
   type: INTEGER
-- mode: NULLABLE
-  name: click_count
+  mode: NULLABLE
+- name: click_count
   type: INTEGER
-- mode: NULLABLE
-  name: query_type
+  mode: NULLABLE
+- name: query_type
   type: STRING
+  mode: NULLABLE
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix/funnel_retention_clients/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix/funnel_retention_clients/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix/funnel_retention_clients/schema.yaml	2024-06-28 22:15:57.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix/funnel_retention_clients/schema.yaml	2024-06-28 22:23:16.000000000 +0000
@@ -26,6 +26,9 @@
 - name: adjust_network
   type: STRING
   mode: NULLABLE
+- name: install_source
+  type: STRING
+  mode: NULLABLE
 - name: retained_week_2
   type: BOOLEAN
   mode: NULLABLE
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix/funnel_retention_week_4/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix/funnel_retention_week_4/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/fenix/funnel_retention_week_4/schema.yaml	2024-06-28 22:15:57.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/fenix/funnel_retention_week_4/schema.yaml	2024-06-28 22:23:16.000000000 +0000
@@ -48,6 +48,10 @@
   description: 'The type of source of a client installation.
 
     '
+- name: install_source
+  type: STRING
+  mode: NULLABLE
+  description: null
 - name: new_profiles
   type: INTEGER
   mode: NULLABLE
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/google_search_console/search_impressions_by_page/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/google_search_console/search_impressions_by_page/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/google_search_console/search_impressions_by_page/schema.yaml	2024-06-28 22:15:57.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/google_search_console/search_impressions_by_page/schema.yaml	2024-06-28 22:22:17.000000000 +0000
@@ -6,9 +6,10 @@
 - name: site_url
   type: STRING
   mode: NULLABLE
-  description: |-
-    For domain properties, this will be `sc-domain:` followed by the domain name.
-    For URL-prefix properties, it will be the full URL of the property definition.
+  description: 'For domain properties, this will be `sc-domain:` followed by the domain
+    name.
+
+    For URL-prefix properties, it will be the full URL of the property definition.'
 - name: site_domain_name
   type: STRING
   mode: NULLABLE
@@ -16,103 +17,110 @@
 - name: page_url
   type: STRING
   mode: NULLABLE
-  description: |-
-    The final page URL linked by a search result after any skip redirects.
-    This will be null for anonymized Discover impressions.
+  description: 'The final page URL linked by a search result after any skip redirects.
+
+    This will be null for anonymized Discover impressions.'
 - name: page_domain_name
   type: STRING
   mode: NULLABLE
-  description: |-
-    Domain name of the page URL.
-    This will be null for anonymized Discover impressions.
+  description: 'Domain name of the page URL.
+
+    This will be null for anonymized Discover impressions.'
 - name: page_path
   type: STRING
   mode: NULLABLE
-  description: |-
-    The path part of the page URL.
-    This will be null for anonymized Discover impressions.
+  description: 'The path part of the page URL.
+
+    This will be null for anonymized Discover impressions.'
 - name: localized_site_code
   type: STRING
   mode: NULLABLE
-  description: |-
-    Localized site code such as `en-US` or `de` found in the first segment of the page URL path (if any).
-    This will be null for anonymized Discover impressions.
+  description: 'Localized site code such as `en-US` or `de` found in the first segment
+    of the page URL path (if any).
+
+    This will be null for anonymized Discover impressions.'
 - name: localized_site
   type: STRING
   mode: NULLABLE
-  description: |-
-    Description of the localized site language and/or country based on `localized_site_code` (if any).
-    This will be null for anonymized Discover impressions.
+  description: 'Description of the localized site language and/or country based on
+    `localized_site_code` (if any).
+
+    This will be null for anonymized Discover impressions.'
 - name: localized_site_language_code
   type: STRING
   mode: NULLABLE
-  description: |-
-    Localized site language code in ISO-639-alpha-2 format found in the first segment of the page URL path (if any).
-    This will be null for anonymized Discover impressions.
+  description: 'Localized site language code in ISO-639-alpha-2 format found in the
+    first segment of the page URL path (if any).
+
+    This will be null for anonymized Discover impressions.'
 - name: localized_site_language
   type: STRING
   mode: NULLABLE
-  description: |-
-    Localized site language based on `localized_site_language_code` (if any).
-    This will be null for anonymized Discover impressions.
+  description: 'Localized site language based on `localized_site_language_code` (if
+    any).
+
+    This will be null for anonymized Discover impressions.'
 - name: query
   type: STRING
   mode: NULLABLE
-  description: |-
-    The search query.
-    This will be null for anonymized search impressions, and all Discover and Google News search impressions.
+  description: 'The search query.
+
+    This will be null for anonymized search impressions, and all Discover and Google
+    News search impressions.'
 - name: query_type
   type: STRING
   mode: NULLABLE
-  description: |-
-    Type of search query:
-      * Anonymized: Query was redacted by Google to protect the users' privacy.
-      * Brand: Query contained one or more Mozilla brand keywords.
-      * Non-Brand: Query didn't contain any Mozilla brand keywords.
-      * Unknown: Query couldn't be classified.
-    This will be null for all Discover and Google News search impressions.
+  description: "Type of search query:\n  * Anonymized: Query was redacted by Google\
+    \ to protect the users' privacy.\n  * Brand: Query contained one or more Mozilla\
+    \ brand keywords.\n  * Non-Brand: Query didn't contain any Mozilla brand keywords.\n\
+    \  * Unknown: Query couldn't be classified.\nThis will be null for all Discover\
+    \ and Google News search impressions."
 - name: is_anonymized
   type: BOOLEAN
   mode: NULLABLE
-  description: |-
-    Whether Google has anonymized the search impression to protect the users' privacy.
+  description: 'Whether Google has anonymized the search impression to protect the
+    users'' privacy.
+
     The `query` field will be null for anonymized search impressions.
-    The `country_code`, `page_url`, and related fields will be null for anonymized Discover impressions.
+
+    The `country_code`, `page_url`, and related fields will be null for anonymized
+    Discover impressions.'
 - name: has_good_page_experience
   type: BOOLEAN
   mode: NULLABLE
-  description: |-
-    Whether Google Search considers the page to be providing a good page experience.
-    This will be null when the source data wasn't exported directly to BigQuery by Google.
+  description: 'Whether Google Search considers the page to be providing a good page
+    experience.
+
+    This will be null when the source data wasn''t exported directly to BigQuery by
+    Google.'
 - name: search_type
   type: STRING
   mode: NULLABLE
-  description: |-
-    Where the link was seen by the user:
-      * Web: In Google Search's default "All" tab.
-      * Image: In Google Search's "Images" tab.
-      * Video: In Google Search's "Videos" tab.
-      * News: In Google Search's "News" tab.
-      * Discover: In Google's Discover feed.
-      * Google News: On news.google.com or in the Google News app on Android and iOS.
+  description: "Where the link was seen by the user:\n  * Web: In Google Search's\
+    \ default \"All\" tab.\n  * Image: In Google Search's \"Images\" tab.\n  * Video:\
+    \ In Google Search's \"Videos\" tab.\n  * News: In Google Search's \"News\" tab.\n\
+    \  * Discover: In Google's Discover feed.\n  * Google News: On news.google.com\
+    \ or in the Google News app on Android and iOS."
 - name: search_appearance
   type: STRING
   mode: NULLABLE
-  description: |-
-    How the search result appeared (e.g. normal result, translated result, video).
-    This will be null when the source data wasn't exported directly to BigQuery by Google.
+  description: 'How the search result appeared (e.g. normal result, translated result,
+    video).
+
+    This will be null when the source data wasn''t exported directly to BigQuery by
+    Google.'
 - name: user_country_code
   type: STRING
   mode: NULLABLE
-  description: |-
-    Country from which the user was searching, in ISO-3166-1-alpha-3 format.
-    This will be null for anonymized Discover impressions.
+  description: 'Country from which the user was searching, in ISO-3166-1-alpha-3 format.
+
+    This will be null for anonymized Discover impressions.'
 - name: user_country
   type: STRING
   mode: NULLABLE
-  description: |-
-    Country from which the user was searching.
-    This will be null for anonymized Discover impressions.
+  description: 'Country from which the user was searching.
+
+    This will be null for anonymized Discover impressions.'
 - name: user_region
   type: STRING
   mode: NULLABLE
@@ -124,13 +132,15 @@
 - name: device_type
   type: STRING
   mode: NULLABLE
-  description: |-
-    The type of device on which the user was searching: Desktop, Mobile, or Tablet.
-    This will be null for Discover impressions.
+  description: 'The type of device on which the user was searching: Desktop, Mobile,
+    or Tablet.
+
+    This will be null for Discover impressions.'
 - name: impressions
   type: INTEGER
   mode: NULLABLE
-  description: The number of times that search results with a link to the page were shown to a user.
+  description: The number of times that search results with a link to the page were
+    shown to a user.
 - name: clicks
   type: INTEGER
   mode: NULLABLE
@@ -138,6 +148,7 @@
 - name: average_position
   type: FLOAT
   mode: NULLABLE
-  description: |-
-    The average position of the page in the search results, where `1` is the topmost position.
-    This will be null for Discover and Google News search impressions.
+  description: 'The average position of the page in the search results, where `1`
+    is the topmost position.
+
+    This will be null for Discover and Google News search impressions.'
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/google_search_console/search_impressions_by_site/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/google_search_console/search_impressions_by_site/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/google_search_console/search_impressions_by_site/schema.yaml	2024-06-28 22:15:57.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/google_search_console/search_impressions_by_site/schema.yaml	2024-06-28 22:22:17.000000000 +0000
@@ -6,9 +6,10 @@
 - name: site_url
   type: STRING
   mode: NULLABLE
-  description: |-
-    For domain properties, this will be `sc-domain:` followed by the domain name.
-    For URL-prefix properties, it will be the full URL of the property definition.
+  description: 'For domain properties, this will be `sc-domain:` followed by the domain
+    name.
+
+    For URL-prefix properties, it will be the full URL of the property definition.'
 - name: site_domain_name
   type: STRING
   mode: NULLABLE
@@ -20,27 +21,23 @@
 - name: query_type
   type: STRING
   mode: NULLABLE
-  description: |-
-    Type of search query:
-      * Anonymized: Query was redacted by Google to protect the users' privacy.
-      * Brand: Query contained one or more Mozilla brand keywords.
-      * Non-Brand: Query didn't contain any Mozilla brand keywords.
-      * Unknown: Query couldn't be classified.
+  description: "Type of search query:\n  * Anonymized: Query was redacted by Google\
+    \ to protect the users' privacy.\n  * Brand: Query contained one or more Mozilla\
+    \ brand keywords.\n  * Non-Brand: Query didn't contain any Mozilla brand keywords.\n\
+    \  * Unknown: Query couldn't be classified."
 - name: is_anonymized
   type: BOOLEAN
   mode: NULLABLE
-  description: |-
-    Whether Google has anonymized the search impression to protect the users' privacy.
-    The `query` field will be null for anonymized search impressions.
+  description: 'Whether Google has anonymized the search impression to protect the
+    users'' privacy.
+
+    The `query` field will be null for anonymized search impressions.'
 - name: search_type
   type: STRING
   mode: NULLABLE
-  description: |-
-    Where the link was seen by the user:
-      * Web: In Google Search's default "All" tab.
-      * Image: In Google Search's "Images" tab.
-      * Video: In Google Search's "Videos" tab.
-      * News: In Google Search's "News" tab.
+  description: "Where the link was seen by the user:\n  * Web: In Google Search's\
+    \ default \"All\" tab.\n  * Image: In Google Search's \"Images\" tab.\n  * Video:\
+    \ In Google Search's \"Videos\" tab.\n  * News: In Google Search's \"News\" tab."
 - name: user_country_code
   type: STRING
   mode: NULLABLE
@@ -60,17 +57,20 @@
 - name: device_type
   type: STRING
   mode: NULLABLE
-  description: |-
-    The type of device on which the user was searching: Desktop, Mobile, or Tablet.
+  description: 'The type of device on which the user was searching: Desktop, Mobile,
+    or Tablet.'
 - name: impressions
   type: INTEGER
   mode: NULLABLE
-  description: The number of times that search results with at least one link to the site were shown to a user.
+  description: The number of times that search results with at least one link to the
+    site were shown to a user.
 - name: clicks
   type: INTEGER
   mode: NULLABLE
-  description: The number of times a user clicked at least one search result link to the site.
+  description: The number of times a user clicked at least one search result link
+    to the site.
 - name: average_top_position
   type: FLOAT
   mode: NULLABLE
-  description: The average top position of the site in the search results, where `1` is the topmost position.
+  description: The average top position of the site in the search results, where `1`
+    is the topmost position.
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/monitoring/event_monitoring_live/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/monitoring/event_monitoring_live/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/monitoring/event_monitoring_live/schema.yaml	1970-01-01 00:00:00.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/monitoring/event_monitoring_live/schema.yaml	2024-06-28 22:24:33.000000000 +0000
@@ -0,0 +1,37 @@
+fields:
+- name: window_start
+  type: TIMESTAMP
+  mode: NULLABLE
+- name: window_end
+  type: TIMESTAMP
+  mode: NULLABLE
+- name: event_category
+  type: STRING
+  mode: NULLABLE
+- name: event_name
+  type: STRING
+  mode: NULLABLE
+- name: event_extra_key
+  type: STRING
+  mode: NULLABLE
+- name: country
+  type: STRING
+  mode: NULLABLE
+- name: normalized_app_name
+  type: STRING
+  mode: NULLABLE
+- name: channel
+  type: STRING
+  mode: NULLABLE
+- name: version
+  type: STRING
+  mode: NULLABLE
+- name: experiment
+  type: STRING
+  mode: NULLABLE
+- name: experiment_branch
+  type: STRING
+  mode: NULLABLE
+- name: total_events
+  type: INTEGER
+  mode: NULLABLE
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/org_mozilla_fenix/geckoview_version/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/org_mozilla_fenix/geckoview_version/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/org_mozilla_fenix/geckoview_version/schema.yaml	2024-06-28 22:15:57.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/org_mozilla_fenix/geckoview_version/schema.yaml	2024-06-28 22:24:33.000000000 +0000
@@ -1,7 +1,13 @@
 fields:
-- type: DATETIME
-  name: build_hour
-- type: INTEGER
-  name: geckoview_major_version
-- type: INTEGER
-  name: n_pings
+- name: build_hour
+  type: DATETIME
+  mode: NULLABLE
+  description: null
+- name: geckoview_major_version
+  type: INTEGER
+  mode: NULLABLE
+  description: null
+- name: n_pings
+  type: INTEGER
+  mode: NULLABLE
+  description: null
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/search_derived/mobile_search_aggregates_v1/backfill.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/search_derived/mobile_search_aggregates_v1/backfill.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/search_derived/mobile_search_aggregates_v1/backfill.yaml	2024-06-28 22:15:58.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/search_derived/mobile_search_aggregates_v1/backfill.yaml	1970-01-01 00:00:00.000000000 +0000
@@ -1,9 +0,0 @@
-2024-06-27:
-  start_date: 2024-04-01
-  end_date: 2024-05-31
-  reason: https://mozilla-hub.atlassian.net/browse/RS-1247
-  watchers:
-  - akommasani@mozilla.com
-  - skahmann@mozilla.com
-  - pissac@mozilla.com
-  status: Initiate
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/search_derived/mobile_search_clients_daily_v1/backfill.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/search_derived/mobile_search_clients_daily_v1/backfill.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/search_derived/mobile_search_clients_daily_v1/backfill.yaml	2024-06-28 22:15:58.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/search_derived/mobile_search_clients_daily_v1/backfill.yaml	2024-06-28 22:16:42.000000000 +0000
@@ -5,4 +5,4 @@
   watchers:
   - akommasani@mozilla.com
   - skahmannz@mozilla.com
-  status: Complete
+  status: Initiate
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/search_derived/search_aggregates_v8/backfill.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/search_derived/search_aggregates_v8/backfill.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/search_derived/search_aggregates_v8/backfill.yaml	2024-06-28 22:15:58.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/search_derived/search_aggregates_v8/backfill.yaml	1970-01-01 00:00:00.000000000 +0000
@@ -1,9 +0,0 @@
-2024-06-27:
-  start_date: 2024-04-01
-  end_date: 2024-05-31
-  reason: https://mozilla-hub.atlassian.net/browse/RS-1247
-  watchers:
-  - akommasani@mozilla.com
-  - skahmann@mozilla.com
-  - pissac@mozilla.com
-  status: Initiate
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/search_derived/search_clients_daily_v8/backfill.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/search_derived/search_clients_daily_v8/backfill.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/search_derived/search_clients_daily_v8/backfill.yaml	2024-06-28 22:15:58.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/search_derived/search_clients_daily_v8/backfill.yaml	2024-06-28 22:16:42.000000000 +0000
@@ -5,4 +5,4 @@
   watchers:
   - akommasani@mozilla.com
   - skahmann@mozilla.com
-  status: Complete
+  status: Initiate
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/daily_active_logical_subscriptions_v1/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/daily_active_logical_subscriptions_v1/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/daily_active_logical_subscriptions_v1/schema.yaml	2024-06-28 22:15:58.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/daily_active_logical_subscriptions_v1/schema.yaml	2024-06-28 22:16:42.000000000 +0000
@@ -51,6 +51,10 @@
   - name: country_name
     type: STRING
     mode: NULLABLE
+  - name: state_code
+    type: STRING
+    mode: NULLABLE
+    description: Two-letter state/province code (only for US and Canada).
   - name: services
     type: RECORD
     mode: REPEATED
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/logical_subscription_events_v1/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/logical_subscription_events_v1/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/logical_subscription_events_v1/schema.yaml	2024-06-28 22:15:58.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/logical_subscription_events_v1/schema.yaml	2024-06-28 22:16:42.000000000 +0000
@@ -57,6 +57,10 @@
   - name: country_name
     type: STRING
     mode: NULLABLE
+  - name: state_code
+    type: STRING
+    mode: NULLABLE
+    description: Two-letter state/province code (only for US and Canada).
   - name: services
     type: RECORD
     mode: REPEATED
@@ -241,6 +245,10 @@
   - name: country_name
     type: STRING
     mode: NULLABLE
+  - name: state_code
+    type: STRING
+    mode: NULLABLE
+    description: Two-letter state/province code (only for US and Canada).
   - name: services
     type: RECORD
     mode: REPEATED
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/logical_subscriptions_history_v1/query.sql /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/logical_subscriptions_history_v1/query.sql
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/logical_subscriptions_history_v1/query.sql	2024-06-28 22:15:58.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/logical_subscriptions_history_v1/query.sql	2024-06-28 22:16:42.000000000 +0000
@@ -146,6 +146,7 @@
     ) AS customer_subscription_number,
     history.subscription.country_code,
     COALESCE(countries.name, history.subscription.country_code, 'Unknown') AS country_name,
+    history.subscription.state_code,
     history.subscription.services,
     history.subscription.provider_product_id,
     history.subscription.product_name,
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/logical_subscriptions_history_v1/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/logical_subscriptions_history_v1/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/logical_subscriptions_history_v1/schema.yaml	2024-06-28 22:15:58.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/logical_subscriptions_history_v1/schema.yaml	2024-06-28 22:16:42.000000000 +0000
@@ -54,6 +54,10 @@
   - name: country_name
     type: STRING
     mode: NULLABLE
+  - name: state_code
+    type: STRING
+    mode: NULLABLE
+    description: Two-letter state/province code (only for US and Canada).
   - name: services
     type: RECORD
     mode: REPEATED
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/monthly_active_logical_subscriptions_v1/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/monthly_active_logical_subscriptions_v1/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/monthly_active_logical_subscriptions_v1/schema.yaml	2024-06-28 22:15:58.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/monthly_active_logical_subscriptions_v1/schema.yaml	2024-06-28 22:16:42.000000000 +0000
@@ -54,6 +54,10 @@
   - name: country_name
     type: STRING
     mode: NULLABLE
+  - name: state_code
+    type: STRING
+    mode: NULLABLE
+    description: Two-letter state/province code (only for US and Canada).
   - name: services
     type: RECORD
     mode: REPEATED
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_customers_history_v1/metadata.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_customers_history_v1/metadata.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_customers_history_v1/metadata.yaml	2024-06-28 22:17:32.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_customers_history_v1/metadata.yaml	2024-06-28 22:28:50.000000000 +0000
@@ -8,7 +8,8 @@
 
   This table's schema closely mirrors Stripe's customers API (https://stripe.com/docs/api/customers/object).
   Fields which Fivetran doesn't sync and fields we've specifically chosen not to include (e.g. PII) have been omitted.
-  In particular, all address fields except country have been omitted because Firefox Account user IDs are present and this is in a Mozilla-confidential dataset.
+  In particular, all address fields except country and state have been omitted because Firefox Account user IDs
+  are present and this is in a Mozilla-confidential dataset.
 owners:
 - srose@mozilla.com
 labels:
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_customers_history_v1/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_customers_history_v1/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_customers_history_v1/schema.yaml	2024-06-28 22:15:58.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_customers_history_v1/schema.yaml	2024-06-28 22:16:42.000000000 +0000
@@ -38,6 +38,10 @@
       type: STRING
       mode: NULLABLE
       description: Two-letter country code (ISO 3166-1 alpha-2).
+    - name: state
+      type: STRING
+      mode: NULLABLE
+      description: Two-letter state/province code (only for US and Canada).
   - name: created
     type: TIMESTAMP
     mode: NULLABLE
@@ -200,6 +204,10 @@
         type: STRING
         mode: NULLABLE
         description: Two-letter country code (ISO 3166-1 alpha-2).
+      - name: state
+        type: STRING
+        mode: NULLABLE
+        description: Two-letter state/province code (only for US and Canada).
   - name: tax_exempt
     type: STRING
     mode: NULLABLE
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_customers_revised_changelog_v1/metadata.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_customers_revised_changelog_v1/metadata.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_customers_revised_changelog_v1/metadata.yaml	2024-06-28 22:17:32.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_customers_revised_changelog_v1/metadata.yaml	2024-06-28 22:28:50.000000000 +0000
@@ -7,7 +7,8 @@
 
   This table's schema closely mirrors Stripe's customers API (https://stripe.com/docs/api/customers/object).
   Fields which Fivetran doesn't sync and fields we've specifically chosen not to include (e.g. PII) have been omitted.
-  In particular, all address fields except country have been omitted because Firefox Account user IDs are present and this is in a Mozilla-confidential dataset.
+  In particular, all address fields except country and state have been omitted because Firefox Account user IDs
+  are present and this is in a Mozilla-confidential dataset.
 owners:
 - srose@mozilla.com
 labels:
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_customers_revised_changelog_v1/query.sql /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_customers_revised_changelog_v1/query.sql
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_customers_revised_changelog_v1/query.sql	2024-06-28 22:15:58.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_customers_revised_changelog_v1/query.sql	2024-06-28 22:16:42.000000000 +0000
@@ -40,18 +40,69 @@
             JSON_VALUE(customer.metadata.userid) AS userid,
             TO_HEX(SHA256(JSON_VALUE(customer.metadata.userid))) AS userid_sha256
           ) AS metadata,
-          -- Limit address data to just country since the metadata includes FxA user IDs
-          -- and this is in a Mozilla-confidential dataset.
-          STRUCT(customer.address.country) AS address,
+          -- Limit address data to country and state since the metadata includes FxA user IDs
+          -- and this is in a Mozilla-confidential dataset.  State is only for US and Canada.
+          STRUCT(
+            NULLIF(customer.address.country, "") AS country,
+            IF(
+              customer.address.country IN ("US", "CA"),
+              COALESCE(
+                -- Only use two-letter codes for consistency since billing addresses sometimes have full names
+                IF(LENGTH(customer.address.state) = 2, customer.address.state, NULL),
+                us_zip_code_prefixes.state_code,
+                ca_postal_districts.province_code
+              ),
+              NULL
+            ) AS state
+          ) AS address,
           (
             SELECT AS STRUCT
-              customer.shipping.* REPLACE (STRUCT(customer.shipping.address.country) AS address)
+              customer.shipping.* REPLACE (
+                STRUCT(
+                  NULLIF(customer.shipping.address.country, "") AS country,
+                  IF(
+                    customer.shipping.address.country IN ("US", "CA"),
+                    COALESCE(
+                      IF(
+                        LENGTH(customer.shipping.address.state) = 2,
+                        customer.shipping.address.state,
+                        NULL
+                      ),
+                      us_shipping_zip_code_prefixes.state_code,
+                      ca_shipping_postal_districts.province_code
+                    ),
+                    NULL
+                  ) AS state
+                ) AS address
+              )
           ) AS shipping
         )
     ) AS customer,
     ROW_NUMBER() OVER customer_changes_asc AS customer_change_number
   FROM
     `moz-fx-data-shared-prod`.stripe_external.customers_changelog_v1
+  -- try to get state using postal code if state field is unavailable
+  LEFT JOIN
+    `moz-fx-data-shared-prod.static.us_zip_code_prefixes_v1` AS us_shipping_zip_code_prefixes
+    ON customer.shipping.address.country = "US"
+    AND LEFT(
+      customer.shipping.address.postal_code,
+      3
+    ) = us_shipping_zip_code_prefixes.zip_code_prefix
+  LEFT JOIN
+    `moz-fx-data-shared-prod.static.us_zip_code_prefixes_v1` AS us_zip_code_prefixes
+    ON customer.address.country = "US"
+    AND LEFT(customer.address.postal_code, 3) = us_zip_code_prefixes.zip_code_prefix
+  LEFT JOIN
+    `moz-fx-data-shared-prod.static.ca_postal_districts_v1` AS ca_shipping_postal_districts
+    ON customer.shipping.address.country = "CA"
+    AND UPPER(
+      LEFT(customer.shipping.address.postal_code, 1)
+    ) = ca_shipping_postal_districts.postal_district_code
+  LEFT JOIN
+    `moz-fx-data-shared-prod.static.ca_postal_districts_v1` AS ca_postal_districts
+    ON customer.address.country = "CA"
+    AND UPPER(LEFT(customer.address.postal_code, 1)) = ca_postal_districts.postal_district_code
   WINDOW
     customer_changes_asc AS (
       PARTITION BY
@@ -68,7 +119,7 @@
     TIMESTAMP '2022-03-25 00:02:29' AS `timestamp`,
     STRUCT(
       id,
-      STRUCT(address.country) AS address,
+      STRUCT(address.country, address.state) AS address,
       created,
       CAST(NULL AS STRING) AS default_source_id,
       CAST(
@@ -103,7 +154,7 @@
         CAST(NULL AS STRING) AS userid,
         JSON_VALUE(metadata.userid_sha256) AS userid_sha256
       ) AS metadata,
-      CAST(NULL AS STRUCT<address STRUCT<country STRING>>) AS shipping,
+      CAST(NULL AS STRUCT<address STRUCT<country STRING, state STRING>>) AS shipping,
       CAST(NULL AS STRING) AS tax_exempt
     ) AS customer,
     1 AS customer_change_number
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_customers_revised_changelog_v1/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_customers_revised_changelog_v1/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_customers_revised_changelog_v1/schema.yaml	2024-06-28 22:15:58.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_customers_revised_changelog_v1/schema.yaml	2024-06-28 22:16:42.000000000 +0000
@@ -48,6 +48,10 @@
       type: STRING
       mode: NULLABLE
       description: Two-letter country code (ISO 3166-1 alpha-2).
+    - name: state
+      type: STRING
+      mode: NULLABLE
+      description: Two-letter state/province code (only for US and Canada).
   - name: created
     type: TIMESTAMP
     mode: NULLABLE
@@ -210,6 +214,10 @@
         type: STRING
         mode: NULLABLE
         description: Two-letter country code (ISO 3166-1 alpha-2).
+      - name: state
+        type: STRING
+        mode: NULLABLE
+        description: Two-letter state/province code (only for US and Canada).
   - name: tax_exempt
     type: STRING
     mode: NULLABLE
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_logical_subscriptions_history_v1/query.sql /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_logical_subscriptions_history_v1/query.sql
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_logical_subscriptions_history_v1/query.sql	2024-06-28 22:15:58.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_logical_subscriptions_history_v1/query.sql	2024-06-28 22:16:42.000000000 +0000
@@ -62,14 +62,21 @@
   SELECT
     history.id AS subscriptions_history_id,
     ARRAY_AGG(
-      cards.country IGNORE NULLS
+      IF(
+        cards.country IS NOT NULL,
+        STRUCT(
+          cards.country AS latest_card_country,
+          COALESCE(charge_us_zip.state_code, charge_ca_post.province_code) AS latest_card_state
+        ),
+        NULL
+      ) IGNORE NULLS
       ORDER BY
-        -- Prefer charges that succeeded.
+        -- Prefer charges that succeeded
         IF(charges.status = 'succeeded', 1, 2),
         charges.created DESC
       LIMIT
         1
-    )[SAFE_ORDINAL(1)] AS latest_card_country,
+    )[SAFE_ORDINAL(1)].*,
     LOGICAL_OR(refunds.status = 'succeeded') AS has_refunds,
     LOGICAL_OR(
       charges.fraud_details_user_report = 'fraudulent'
@@ -94,6 +101,18 @@
   LEFT JOIN
     `moz-fx-data-shared-prod.stripe_external.refund_v1` AS refunds
     ON charges.id = refunds.charge_id
+  -- charges usually have postal code and are sometimes associated with
+  -- a card that does not have a state or postal code
+  LEFT JOIN
+    `moz-fx-data-shared-prod.static.us_zip_code_prefixes_v1` AS charge_us_zip
+    ON cards.country = "US"
+    AND LEFT(charges.billing_detail_address_postal_code, 3) = charge_us_zip.zip_code_prefix
+  LEFT JOIN
+    `moz-fx-data-shared-prod.static.ca_postal_districts_v1` AS charge_ca_post
+    ON cards.country = "CA"
+    AND UPPER(
+      LEFT(charges.billing_detail_address_postal_code, 1)
+    ) = charge_ca_post.postal_district_code
   GROUP BY
     subscriptions_history_id
 )
@@ -109,7 +128,8 @@
   history.valid_from,
   history.valid_to,
   history.id AS provider_subscriptions_history_id,
-  STRUCT(
+  (
+    SELECT AS STRUCT
     CONCAT(
       'Stripe-',
       history.subscription.id,
@@ -124,24 +144,44 @@
     history.subscription.customer.id AS provider_customer_id,
     history.subscription.customer.metadata.userid AS mozilla_account_id,
     history.subscription.customer.metadata.userid_sha256 AS mozilla_account_id_sha256,
+      (
     CASE
-      -- Use the same address hierarchy as Stripe Tax after we enabled Stripe Tax (FXA-5457).
+          -- Use the same address hierarchy as Stripe Tax after we enabled Stripe Tax on 2022-12-01 (FXA-5457).
       -- https://stripe.com/docs/tax/customer-locations#address-hierarchy
       WHEN DATE(history.valid_to) >= '2022-12-01'
         AND (
           DATE(history.subscription.ended_at) >= '2022-12-01'
           OR history.subscription.ended_at IS NULL
         )
-        THEN COALESCE(
-            NULLIF(history.subscription.customer.shipping.address.country, ''),
-            NULLIF(history.subscription.customer.address.country, ''),
-            charge_summaries.latest_card_country
+            THEN
+              CASE
+                WHEN history.subscription.customer.shipping.address.country IS NOT NULL
+                  THEN STRUCT(
+                      history.subscription.customer.shipping.address.country AS country_code,
+                      history.subscription.customer.shipping.address.state AS state_code
+                    )
+                WHEN history.subscription.customer.address.country IS NOT NULL
+                  THEN STRUCT(
+                      history.subscription.customer.address.country AS country_code,
+                      history.subscription.customer.address.state AS state_code
           )
-      -- SubPlat copies the PayPal billing agreement country to the customer's address.
+                ELSE STRUCT(
+                    charge_summaries.latest_card_country AS country_code,
+                    charge_summaries.latest_card_state AS state_code
+                  )
+              END
+          -- SubPlat copied the PayPal billing agreement country to the customer's address before we enabled Stripe Tax (FXA-5457).
       WHEN paypal_subscriptions.subscription_id IS NOT NULL
-        THEN NULLIF(history.subscription.customer.address.country, '')
-      ELSE charge_summaries.latest_card_country
-    END AS country_code,
+            THEN STRUCT(
+                history.subscription.customer.address.country AS country_code,
+                history.subscription.customer.address.state AS state_code
+              )
+          ELSE STRUCT(
+              charge_summaries.latest_card_country AS country_code,
+              charge_summaries.latest_card_state AS state_code
+            )
+        END
+      ).*,
     plan_services.services,
     subscription_item.plan.product.id AS provider_product_id,
     subscription_item.plan.product.name AS product_name,
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_logical_subscriptions_history_v1/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_logical_subscriptions_history_v1/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_logical_subscriptions_history_v1/schema.yaml	2024-06-28 22:15:58.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_logical_subscriptions_history_v1/schema.yaml	2024-06-28 22:16:42.000000000 +0000
@@ -45,6 +45,10 @@
   - name: country_code
     type: STRING
     mode: NULLABLE
+  - name: state_code
+    type: STRING
+    mode: NULLABLE
+    description: Two-letter state/province code (only for US and Canada).
   - name: services
     type: RECORD
     mode: REPEATED
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_subscriptions_history_v2/metadata.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_subscriptions_history_v2/metadata.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_subscriptions_history_v2/metadata.yaml	2024-06-28 22:17:32.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_subscriptions_history_v2/metadata.yaml	2024-06-28 22:28:50.000000000 +0000
@@ -8,7 +8,8 @@
 
   This table's schema closely mirrors Stripe's subscriptions API (https://stripe.com/docs/api/subscriptions/object).
   Fields which Fivetran doesn't sync and fields we've specifically chosen not to include (e.g. PII) have been omitted.
-  In particular, all address fields except country have been omitted because Firefox Account user IDs are present and this is in a Mozilla-confidential dataset.
+  In particular, all address fields except country and state have been omitted because Firefox Account user IDs
+  are present and this is in a Mozilla-confidential dataset.
 owners:
 - srose@mozilla.com
 labels:
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_subscriptions_history_v2/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_subscriptions_history_v2/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_subscriptions_history_v2/schema.yaml	2024-06-28 22:15:58.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_subscriptions_history_v2/schema.yaml	2024-06-28 22:16:42.000000000 +0000
@@ -53,6 +53,10 @@
         type: STRING
         mode: NULLABLE
         description: Two-letter country code (ISO 3166-1 alpha-2).
+      - name: state
+        type: STRING
+        mode: NULLABLE
+        description: Two-letter state/province code (only for US and Canada).
     - name: created
       type: TIMESTAMP
       mode: NULLABLE
@@ -218,6 +222,10 @@
           type: STRING
           mode: NULLABLE
           description: Two-letter country code (ISO 3166-1 alpha-2).
+        - name: state
+          type: STRING
+          mode: NULLABLE
+          description: Two-letter state/province code (only for US and Canada).
     - name: tax_exempt
       type: STRING
       mode: NULLABLE
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_subscriptions_v2/metadata.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_subscriptions_v2/metadata.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_subscriptions_v2/metadata.yaml	2024-06-28 22:17:32.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_subscriptions_v2/metadata.yaml	2024-06-28 22:28:50.000000000 +0000
@@ -4,7 +4,8 @@
 
   This table's schema closely mirrors Stripe's subscriptions API (https://stripe.com/docs/api/subscriptions/object).
   Fields which Fivetran doesn't sync and fields we've specifically chosen not to include (e.g. PII) have been omitted.
-  In particular, all address fields except country have been omitted because Firefox Account user IDs are present and this is in a Mozilla-confidential dataset.
+  In particular, all address fields except country and state have been omitted because Firefox Account user IDs
+  are present and this is in a Mozilla-confidential dataset.
 owners:
 - srose@mozilla.com
 labels:
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_subscriptions_v2/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_subscriptions_v2/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_subscriptions_v2/schema.yaml	2024-06-28 22:15:58.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_subscriptions_v2/schema.yaml	2024-06-28 22:16:42.000000000 +0000
@@ -21,6 +21,10 @@
       type: STRING
       mode: NULLABLE
       description: Two-letter country code (ISO 3166-1 alpha-2).
+    - name: state
+      type: STRING
+      mode: NULLABLE
+      description: Two-letter state/province code (only for US and Canada).
   - name: created
     type: TIMESTAMP
     mode: NULLABLE
@@ -183,6 +187,10 @@
         type: STRING
         mode: NULLABLE
         description: Two-letter country code (ISO 3166-1 alpha-2).
+      - name: state
+        type: STRING
+        mode: NULLABLE
+        description: Two-letter state/province code (only for US and Canada).
   - name: tax_exempt
     type: STRING
     mode: NULLABLE
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/telemetry/eng_workflow_build_parquet/schema.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/telemetry/eng_workflow_build_parquet/schema.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/telemetry/eng_workflow_build_parquet/schema.yaml	2024-06-28 22:16:31.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/telemetry/eng_workflow_build_parquet/schema.yaml	2024-06-28 22:22:52.000000000 +0000
@@ -28,48 +28,36 @@
   - name: artifact
     type: BOOLEAN
     mode: NULLABLE
-    description: true if --enable-artifact-builds
   - name: ccache
     type: BOOLEAN
     mode: NULLABLE
-    description: true if ccache is in use (--with-ccache)
   - name: compiler
     type: STRING
     mode: NULLABLE
-    description: The compiler type in use (CC_TYPE)
   - name: debug
     type: BOOLEAN
     mode: NULLABLE
-    description: true if build is debug (--enable-debug)
   - name: icecream
     type: BOOLEAN
     mode: NULLABLE
-    description: true if icecream in use
   - name: opt
     type: BOOLEAN
     mode: NULLABLE
-    description: true if build is optimized (--enable-optimize)
   - name: sccache
     type: BOOLEAN
     mode: NULLABLE
-    description: true if ccache in use is sccache
-  description: Selected build options
 - name: client_id
   type: STRING
   mode: NULLABLE
-  description: A UUID to uniquely identify a client
 - name: command
   type: STRING
   mode: NULLABLE
-  description: The mach command that was invoked
 - name: duration_ms
   type: FLOAT
   mode: NULLABLE
-  description: Command duration in milliseconds
 - name: success
   type: BOOLEAN
   mode: NULLABLE
-  description: true if the command succeeded
 - name: system
   type: RECORD
   mode: NULLABLE
@@ -77,40 +65,30 @@
   - name: os
     type: STRING
     mode: NULLABLE
-    description: Operating system
   - name: cpu_brand
     type: STRING
     mode: NULLABLE
-    description: CPU brand string from CPUID
   - name: drive_is_ssd
     type: BOOLEAN
     mode: NULLABLE
-    description: true if the source directory is on a solid-state disk
   - name: logical_cores
     type: INTEGER
     mode: NULLABLE
-    description: Number of logical CPU cores present
   - name: memory_gb
     type: INTEGER
     mode: NULLABLE
-    description: System memory in GB
   - name: physical_cores
     type: INTEGER
     mode: NULLABLE
-    description: Number of physical CPU cores present
   - name: virtual_machine
     type: BOOLEAN
     mode: NULLABLE
-    description: true if the OS appears to be running in a virtual machine
 - name: time
   type: STRING
   mode: NULLABLE
-  description: Time at which this event happened
 - name: exception
   type: STRING
   mode: NULLABLE
-  description: If a Python exception was encountered during the execution of the command,
-    this value contains the result of calling `repr` on the exception object.
 - name: file_types_changed
   type: RECORD
   mode: REPEATED
@@ -118,11 +96,9 @@
   - name: count
     type: INTEGER
     mode: NULLABLE
-    description: Count of changed files with this extension
   - name: ext
     type: STRING
     mode: NULLABLE
-    description: File extension
 - name: build_attrs
   type: RECORD
   mode: NULLABLE
@@ -130,9 +106,6 @@
   - name: clobber
     type: BOOLEAN
     mode: NULLABLE
-    description: true if the build was a clobber/full build
   - name: cpu_percent
     type: FLOAT
     mode: NULLABLE
-    description: cpu utilization observed during a build
-  description: Attributes characterizing a build
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/telemetry_derived/sponsored_tiles_clients_daily_v1/metadata.yaml /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/telemetry_derived/sponsored_tiles_clients_daily_v1/metadata.yaml
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/telemetry_derived/sponsored_tiles_clients_daily_v1/metadata.yaml	2024-06-28 22:17:37.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/telemetry_derived/sponsored_tiles_clients_daily_v1/metadata.yaml	2024-06-28 22:28:46.000000000 +0000
@@ -1,8 +1,6 @@
 friendly_name: Sponsored Tiles Clients Daily
 description: |-
-  daily client-level aggregates of Sponsored Tiles-related fields.
-  Note that for desktop tile dismissals and disables, we deprecated PingCentre's Activity Stream in Fx123,
-  and now rely on Glean's newtab ping as of Fx120. There's an effective cutover version of Fx123.
+  daily client-level aggregates of Sponsored Tiles-related fields
 owners:
 - skahmann@mozilla.com
 - cmorales@mozilla.com
diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/telemetry_derived/sponsored_tiles_clients_daily_v1/query.sql /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/telemetry_derived/sponsored_tiles_clients_daily_v1/query.sql
--- /tmp/workspace/main-generated-sql/sql/moz-fx-data-shared-prod/telemetry_derived/sponsored_tiles_clients_daily_v1/query.sql	2024-06-28 22:15:58.000000000 +0000
+++ /tmp/workspace/generated-sql/sql/moz-fx-data-shared-prod/telemetry_derived/sponsored_tiles_clients_daily_v1/query.sql	2024-06-28 22:16:42.000000000 +0000
@@ -43,8 +43,7 @@
     1,
     2
 ),
------- DESKTOP Dismissals and Disables
---- Note PingCentre was deprecated as of Fx123 (Feb 20, 2024)
+  ------ DESKTOP Dismissals and Disables
 desktop_activity_stream_events AS (
   SELECT
     client_id,
@@ -63,69 +62,9 @@
     `moz-fx-data-shared-prod.activity_stream.events`
   WHERE
     DATE(submission_timestamp) = @submission_date
-    AND CAST(metadata.user_agent.version AS INT64) < 123
   GROUP BY
-    client_id,
-    submission_date
-),
---- Current telemetry for dismissals and deactivations comes in Glean's newtab ping as of Fx120 (Nov 21, 2023)
-desktop_newtab_events AS (
-  SELECT
-    n.client_info.client_id AS client_id,
-    n.metrics.uuid.legacy_telemetry_client_id AS legacy_telemetry_client_id,
-    DATE(submission_timestamp) AS submission_date,
-    COUNTIF(
-      e.category = 'topsites'
-      AND e.name = 'dismiss'
-      AND `mozfun.map.get_key`(e.extra, 'is_sponsored') = 'true'
-    ) AS sponsored_tiles_dismissal_count,
-    COUNTIF(
-      e.name = 'pref_changed'
-      AND `mozfun.map.get_key`(
-        e.extra,
-        'pref_name'
-      ) = 'browser.newtabpage.activity-stream.showSponsoredTopSites'
-      AND `mozfun.map.get_key`(e.extra, 'new_value') = 'false'
-    ) AS sponsored_tiles_disable_count
-  FROM
-    `moz-fx-data-shared-prod.firefox_desktop.newtab` n,
-    UNNEST(events) e
-  WHERE
-    DATE(submission_timestamp) = @submission_date
-    AND `mozfun`.norm.browser_version_info(client_info.app_display_version).major_version >= 123
-  GROUP BY
-    client_id,
-    legacy_telemetry_client_id,
-    submission_date
-),
-desktop_joint_events AS (
-  SELECT
-    n.submission_date,
-    n.legacy_telemetry_client_id AS client_id,
-    n.sponsored_tiles_dismissal_count,
-    n.sponsored_tiles_disable_count
-  FROM
-    desktop_newtab_events n
-  UNION ALL
-  SELECT
-    a.submission_date,
-    a.client_id,
-    a.sponsored_tiles_dismissal_count,
-    a.sponsored_tiles_disable_count
-  FROM
-    desktop_activity_stream_events a
-),
-desktop_agg_events AS (
-  SELECT
-    submission_date,
-    client_id,
-    SUM(sponsored_tiles_dismissal_count) AS sponsored_tiles_dismissal_count,
-    SUM(sponsored_tiles_disable_count) AS sponsored_tiles_disable_count
-  FROM
-    desktop_joint_events
-  GROUP BY
-    submission_date,
-    client_id
+    1,
+    2
 ),
 ------ iOS SPONSORED TILES
 ios_data AS (
@@ -253,7 +192,7 @@
   impressions_main
   USING (client_id, submission_date)
 LEFT JOIN
-  desktop_agg_events
+  desktop_activity_stream_events
   USING (client_id, submission_date)
 -- add experiments data
 LEFT JOIN

Link to full diff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants