diff --git a/bigquery_etl/copy_deduplicate.py b/bigquery_etl/copy_deduplicate.py index 3f8c0635f9..4a3f0fa97c 100644 --- a/bigquery_etl/copy_deduplicate.py +++ b/bigquery_etl/copy_deduplicate.py @@ -57,9 +57,8 @@ WITH `{live_table}` JOIN distinct_document_ids - USING -- Retain only the first seen documents for each ID, according to timestamp. - (document_id, submission_timestamp) + USING (document_id, submission_timestamp) WHERE submission_timestamp >= @start_time AND submission_timestamp < @end_time), diff --git a/bigquery_etl/format_sql/tokenizer.py b/bigquery_etl/format_sql/tokenizer.py index b54d21edcb..60ce1651b0 100644 --- a/bigquery_etl/format_sql/tokenizer.py +++ b/bigquery_etl/format_sql/tokenizer.py @@ -55,7 +55,6 @@ TOP_LEVEL_KEYWORDS = [ "LEFT JOIN", "LEFT OUTER JOIN", "LIMIT", - "ON", "ORDER BY", "OUTER JOIN", "PARTITION BY", @@ -76,7 +75,6 @@ TOP_LEVEL_KEYWORDS = [ "UNION ALL", "UNION DISTINCT", "UNION", - "USING", "VALUES", "WHERE", "WITH(?! OFFSET)", @@ -84,6 +82,8 @@ TOP_LEVEL_KEYWORDS = [ ] # These words start a new line at the current indent NEWLINE_KEYWORDS = [ + "ON", + "USING", "WITH OFFSET", # UDF "CREATE OR REPLACE", diff --git a/bigquery_etl/glam/templates/clients_histogram_aggregates_v1.sql b/bigquery_etl/glam/templates/clients_histogram_aggregates_v1.sql index 3ec179d6c2..2f166f49f7 100644 --- a/bigquery_etl/glam/templates/clients_histogram_aggregates_v1.sql +++ b/bigquery_etl/glam/templates/clients_histogram_aggregates_v1.sql @@ -5,8 +5,7 @@ {% if filter_version %} LEFT JOIN glam_etl.{{ prefix }}__latest_versions_v1 - USING - (channel) + USING (channel) {% endif %} WHERE -- allow for builds to be slighly ahead of the current submission date, to @@ -124,5 +123,4 @@ FROM filtered_accumulated AS accumulated FULL OUTER JOIN transformed_daily AS daily -USING - ({{ attributes }}) + USING ({{ attributes }}) diff --git a/bigquery_etl/glam/templates/clients_scalar_aggregates_v1.sql b/bigquery_etl/glam/templates/clients_scalar_aggregates_v1.sql index 93467e1f98..4d40d81fbb 100644 --- a/bigquery_etl/glam/templates/clients_scalar_aggregates_v1.sql +++ b/bigquery_etl/glam/templates/clients_scalar_aggregates_v1.sql @@ -5,8 +5,7 @@ {% if filter_version %} LEFT JOIN glam_etl.{{ prefix }}__latest_versions_v1 - USING - (channel) + USING (channel) {% endif %} WHERE -- allow for builds to be slighly ahead of the current submission date, to @@ -112,8 +111,7 @@ joined_new_old AS ( filtered_new AS new_data FULL OUTER JOIN filtered_old AS old_data - USING - ({{ attributes }}) + USING ({{ attributes }}) ) SELECT {{ attributes }}, diff --git a/bigquery_etl/glam/templates/histogram_bucket_counts_v1.sql b/bigquery_etl/glam/templates/histogram_bucket_counts_v1.sql index 85bd16335b..0bb1b4ef5e 100644 --- a/bigquery_etl/glam/templates/histogram_bucket_counts_v1.sql +++ b/bigquery_etl/glam/templates/histogram_bucket_counts_v1.sql @@ -110,5 +110,4 @@ FROM records LEFT OUTER JOIN distribution_metadata -USING - (metric_type, metric) \ No newline at end of file + USING (metric_type, metric) \ No newline at end of file diff --git a/bigquery_etl/glam/templates/logical_app_id/org_mozilla_fenix_glam_nightly__view_clients_daily_histogram_aggregates_v1.sql b/bigquery_etl/glam/templates/logical_app_id/org_mozilla_fenix_glam_nightly__view_clients_daily_histogram_aggregates_v1.sql index 84831c3f5a..2e52507f56 100644 --- a/bigquery_etl/glam/templates/logical_app_id/org_mozilla_fenix_glam_nightly__view_clients_daily_histogram_aggregates_v1.sql +++ b/bigquery_etl/glam/templates/logical_app_id/org_mozilla_fenix_glam_nightly__view_clients_daily_histogram_aggregates_v1.sql @@ -47,5 +47,4 @@ FROM with_build_hour JOIN with_geckoview_version_renamed -USING - (build_hour) + USING (build_hour) diff --git a/bigquery_etl/glam/templates/logical_app_id/org_mozilla_fenix_glam_nightly__view_clients_daily_scalar_aggregates_v1.sql b/bigquery_etl/glam/templates/logical_app_id/org_mozilla_fenix_glam_nightly__view_clients_daily_scalar_aggregates_v1.sql index 07cc66546d..5711690add 100644 --- a/bigquery_etl/glam/templates/logical_app_id/org_mozilla_fenix_glam_nightly__view_clients_daily_scalar_aggregates_v1.sql +++ b/bigquery_etl/glam/templates/logical_app_id/org_mozilla_fenix_glam_nightly__view_clients_daily_scalar_aggregates_v1.sql @@ -47,5 +47,4 @@ FROM with_build_hour JOIN with_geckoview_version_renamed -USING - (build_hour) + USING (build_hour) diff --git a/bigquery_etl/glam/templates/scalar_bucket_counts_v1.sql b/bigquery_etl/glam/templates/scalar_bucket_counts_v1.sql index 7fffedd7fd..8cb0d69668 100644 --- a/bigquery_etl/glam/templates/scalar_bucket_counts_v1.sql +++ b/bigquery_etl/glam/templates/scalar_bucket_counts_v1.sql @@ -22,8 +22,7 @@ valid_clients_scalar_aggregates AS ( {{ source_table }} INNER JOIN build_ids - USING - (app_build_id, channel) + USING (app_build_id, channel) ), bucketed_booleans AS ( SELECT diff --git a/bigquery_etl/shredder/delete.py b/bigquery_etl/shredder/delete.py index 5de9a2f767..b3da51b04a 100644 --- a/bigquery_etl/shredder/delete.py +++ b/bigquery_etl/shredder/delete.py @@ -239,8 +239,7 @@ def delete_from_partition( + " AND ".join((source_condition, *source.conditions)) + f""" ) - ON - {field} = _source_{index} + ON {field} = _source_{index} """ for index, (field, source) in enumerate(zip(target.fields, sources)) ) diff --git a/script/marketing/generate_app_store_queries.py b/script/marketing/generate_app_store_queries.py index 184581d240..cfb8a96361 100755 --- a/script/marketing/generate_app_store_queries.py +++ b/script/marketing/generate_app_store_queries.py @@ -35,8 +35,7 @@ WHERE JOIN_TEMPLATE = """ FULL JOIN {table} -USING - ({fields}) + USING ({fields}) """ diff --git a/sql/glam-fenix-dev/glam_etl/firefox_desktop_glam_nightly__clients_histogram_aggregates_v1/query.sql b/sql/glam-fenix-dev/glam_etl/firefox_desktop_glam_nightly__clients_histogram_aggregates_v1/query.sql index d79da28cbc..95f350226f 100644 --- a/sql/glam-fenix-dev/glam_etl/firefox_desktop_glam_nightly__clients_histogram_aggregates_v1/query.sql +++ b/sql/glam-fenix-dev/glam_etl/firefox_desktop_glam_nightly__clients_histogram_aggregates_v1/query.sql @@ -79,8 +79,7 @@ filtered_accumulated AS ( extracted_accumulated LEFT JOIN glam_etl.firefox_desktop_glam_nightly__latest_versions_v1 - USING - (channel) + USING (channel) WHERE -- allow for builds to be slighly ahead of the current submission date, to -- account for a reasonable amount of clock skew @@ -120,8 +119,7 @@ filtered_daily AS ( extracted_daily LEFT JOIN glam_etl.firefox_desktop_glam_nightly__latest_versions_v1 - USING - (channel) + USING (channel) WHERE -- allow for builds to be slighly ahead of the current submission date, to -- account for a reasonable amount of clock skew @@ -208,5 +206,4 @@ FROM filtered_accumulated AS accumulated FULL OUTER JOIN transformed_daily AS daily -USING - (sample_id, client_id, ping_type, os, app_version, app_build_id, channel) + USING (sample_id, client_id, ping_type, os, app_version, app_build_id, channel) diff --git a/sql/glam-fenix-dev/glam_etl/firefox_desktop_glam_nightly__clients_scalar_aggregates_v1/query.sql b/sql/glam-fenix-dev/glam_etl/firefox_desktop_glam_nightly__clients_scalar_aggregates_v1/query.sql index b1087ce71a..c77000b47c 100644 --- a/sql/glam-fenix-dev/glam_etl/firefox_desktop_glam_nightly__clients_scalar_aggregates_v1/query.sql +++ b/sql/glam-fenix-dev/glam_etl/firefox_desktop_glam_nightly__clients_scalar_aggregates_v1/query.sql @@ -132,8 +132,7 @@ version_filtered_new AS ( filtered_aggregates AS scalar_aggs LEFT JOIN glam_etl.firefox_desktop_glam_nightly__latest_versions_v1 - USING - (channel) + USING (channel) WHERE -- allow for builds to be slighly ahead of the current submission date, to -- account for a reasonable amount of clock skew @@ -216,8 +215,7 @@ filtered_old AS ( glam_etl.firefox_desktop_glam_nightly__clients_scalar_aggregates_v1 AS scalar_aggs LEFT JOIN glam_etl.firefox_desktop_glam_nightly__latest_versions_v1 - USING - (channel) + USING (channel) WHERE -- allow for builds to be slighly ahead of the current submission date, to -- account for a reasonable amount of clock skew @@ -243,8 +241,7 @@ joined_new_old AS ( filtered_new AS new_data FULL OUTER JOIN filtered_old AS old_data - USING - (client_id, ping_type, os, app_version, app_build_id, channel) + USING (client_id, ping_type, os, app_version, app_build_id, channel) ) SELECT client_id, diff --git a/sql/glam-fenix-dev/glam_etl/firefox_desktop_glam_nightly__histogram_bucket_counts_v1/query.sql b/sql/glam-fenix-dev/glam_etl/firefox_desktop_glam_nightly__histogram_bucket_counts_v1/query.sql index 776da721d1..b4024fa3ce 100644 --- a/sql/glam-fenix-dev/glam_etl/firefox_desktop_glam_nightly__histogram_bucket_counts_v1/query.sql +++ b/sql/glam-fenix-dev/glam_etl/firefox_desktop_glam_nightly__histogram_bucket_counts_v1/query.sql @@ -84,8 +84,7 @@ unnested AS ( UNNEST(aggregates) AS aggregates INNER JOIN build_ids - USING - (app_build_id, channel) + USING (app_build_id, channel) ), -- Find information that can be used to construct the bucket range. Most of the -- distributions follow a bucketing rule of 8*log2(n). This doesn't apply to the @@ -290,5 +289,4 @@ FROM records LEFT OUTER JOIN distribution_metadata -USING - (metric_type, metric) + USING (metric_type, metric) diff --git a/sql/glam-fenix-dev/glam_etl/firefox_desktop_glam_nightly__scalar_bucket_counts_v1/query.sql b/sql/glam-fenix-dev/glam_etl/firefox_desktop_glam_nightly__scalar_bucket_counts_v1/query.sql index 0052eb42e8..7d6b3bc505 100644 --- a/sql/glam-fenix-dev/glam_etl/firefox_desktop_glam_nightly__scalar_bucket_counts_v1/query.sql +++ b/sql/glam-fenix-dev/glam_etl/firefox_desktop_glam_nightly__scalar_bucket_counts_v1/query.sql @@ -191,8 +191,7 @@ bucketed_scalars AS ( UNNEST(scalar_aggregates) LEFT JOIN buckets_by_metric - USING - (metric, key) + USING (metric, key) WHERE metric_type IN ("counter", "quantity", "labeled_counter", "timespan") ), @@ -242,8 +241,7 @@ valid_booleans_scalars AS ( booleans_and_scalars INNER JOIN build_ids - USING - (app_build_id, channel) + USING (app_build_id, channel) ) SELECT ping_type, diff --git a/sql/glam-fenix-dev/glam_etl/org_mozilla_fenix_glam_nightly__clients_histogram_aggregates_v1/query.sql b/sql/glam-fenix-dev/glam_etl/org_mozilla_fenix_glam_nightly__clients_histogram_aggregates_v1/query.sql index 45c9b72981..639388df66 100644 --- a/sql/glam-fenix-dev/glam_etl/org_mozilla_fenix_glam_nightly__clients_histogram_aggregates_v1/query.sql +++ b/sql/glam-fenix-dev/glam_etl/org_mozilla_fenix_glam_nightly__clients_histogram_aggregates_v1/query.sql @@ -79,8 +79,7 @@ filtered_accumulated AS ( extracted_accumulated LEFT JOIN glam_etl.org_mozilla_fenix_glam_nightly__latest_versions_v1 - USING - (channel) + USING (channel) WHERE -- allow for builds to be slighly ahead of the current submission date, to -- account for a reasonable amount of clock skew @@ -120,8 +119,7 @@ filtered_daily AS ( extracted_daily LEFT JOIN glam_etl.org_mozilla_fenix_glam_nightly__latest_versions_v1 - USING - (channel) + USING (channel) WHERE -- allow for builds to be slighly ahead of the current submission date, to -- account for a reasonable amount of clock skew @@ -208,5 +206,4 @@ FROM filtered_accumulated AS accumulated FULL OUTER JOIN transformed_daily AS daily -USING - (sample_id, client_id, ping_type, os, app_version, app_build_id, channel) + USING (sample_id, client_id, ping_type, os, app_version, app_build_id, channel) diff --git a/sql/glam-fenix-dev/glam_etl/org_mozilla_fenix_glam_nightly__clients_scalar_aggregates_v1/query.sql b/sql/glam-fenix-dev/glam_etl/org_mozilla_fenix_glam_nightly__clients_scalar_aggregates_v1/query.sql index 2b8404de8d..36c0f3e317 100644 --- a/sql/glam-fenix-dev/glam_etl/org_mozilla_fenix_glam_nightly__clients_scalar_aggregates_v1/query.sql +++ b/sql/glam-fenix-dev/glam_etl/org_mozilla_fenix_glam_nightly__clients_scalar_aggregates_v1/query.sql @@ -132,8 +132,7 @@ version_filtered_new AS ( filtered_aggregates AS scalar_aggs LEFT JOIN glam_etl.org_mozilla_fenix_glam_nightly__latest_versions_v1 - USING - (channel) + USING (channel) WHERE -- allow for builds to be slighly ahead of the current submission date, to -- account for a reasonable amount of clock skew @@ -216,8 +215,7 @@ filtered_old AS ( glam_etl.org_mozilla_fenix_glam_nightly__clients_scalar_aggregates_v1 AS scalar_aggs LEFT JOIN glam_etl.org_mozilla_fenix_glam_nightly__latest_versions_v1 - USING - (channel) + USING (channel) WHERE -- allow for builds to be slighly ahead of the current submission date, to -- account for a reasonable amount of clock skew @@ -243,8 +241,7 @@ joined_new_old AS ( filtered_new AS new_data FULL OUTER JOIN filtered_old AS old_data - USING - (client_id, ping_type, os, app_version, app_build_id, channel) + USING (client_id, ping_type, os, app_version, app_build_id, channel) ) SELECT client_id, diff --git a/sql/glam-fenix-dev/glam_etl/org_mozilla_fenix_glam_nightly__histogram_bucket_counts_v1/query.sql b/sql/glam-fenix-dev/glam_etl/org_mozilla_fenix_glam_nightly__histogram_bucket_counts_v1/query.sql index de10e9ee6a..780261ba40 100644 --- a/sql/glam-fenix-dev/glam_etl/org_mozilla_fenix_glam_nightly__histogram_bucket_counts_v1/query.sql +++ b/sql/glam-fenix-dev/glam_etl/org_mozilla_fenix_glam_nightly__histogram_bucket_counts_v1/query.sql @@ -84,8 +84,7 @@ unnested AS ( UNNEST(aggregates) AS aggregates INNER JOIN build_ids - USING - (app_build_id, channel) + USING (app_build_id, channel) ), -- Find information that can be used to construct the bucket range. Most of the -- distributions follow a bucketing rule of 8*log2(n). This doesn't apply to the @@ -274,5 +273,4 @@ FROM records LEFT OUTER JOIN distribution_metadata -USING - (metric_type, metric) + USING (metric_type, metric) diff --git a/sql/glam-fenix-dev/glam_etl/org_mozilla_fenix_glam_nightly__scalar_bucket_counts_v1/query.sql b/sql/glam-fenix-dev/glam_etl/org_mozilla_fenix_glam_nightly__scalar_bucket_counts_v1/query.sql index 04bd0c7b87..eb89c8d2c5 100644 --- a/sql/glam-fenix-dev/glam_etl/org_mozilla_fenix_glam_nightly__scalar_bucket_counts_v1/query.sql +++ b/sql/glam-fenix-dev/glam_etl/org_mozilla_fenix_glam_nightly__scalar_bucket_counts_v1/query.sql @@ -93,8 +93,7 @@ valid_clients_scalar_aggregates AS ( glam_etl.org_mozilla_fenix_glam_nightly__clients_scalar_aggregates_v1 INNER JOIN build_ids - USING - (app_build_id, channel) + USING (app_build_id, channel) ), bucketed_booleans AS ( SELECT @@ -167,8 +166,7 @@ bucketed_scalars AS ( UNNEST(scalar_aggregates) LEFT JOIN buckets_by_metric - USING - (metric, key) + USING (metric, key) WHERE metric_type IN ("counter", "quantity", "labeled_counter", "timespan") ), diff --git a/sql/glam-fenix-dev/glam_etl/org_mozilla_fenix_glam_nightly__view_clients_daily_histogram_aggregates_v1/view.sql b/sql/glam-fenix-dev/glam_etl/org_mozilla_fenix_glam_nightly__view_clients_daily_histogram_aggregates_v1/view.sql index 8d426cf831..e7ab18dc83 100644 --- a/sql/glam-fenix-dev/glam_etl/org_mozilla_fenix_glam_nightly__view_clients_daily_histogram_aggregates_v1/view.sql +++ b/sql/glam-fenix-dev/glam_etl/org_mozilla_fenix_glam_nightly__view_clients_daily_histogram_aggregates_v1/view.sql @@ -47,5 +47,4 @@ FROM with_build_hour JOIN with_geckoview_version_renamed -USING - (build_hour) + USING (build_hour) diff --git a/sql/glam-fenix-dev/glam_etl/org_mozilla_fenix_glam_nightly__view_clients_daily_scalar_aggregates_v1/view.sql b/sql/glam-fenix-dev/glam_etl/org_mozilla_fenix_glam_nightly__view_clients_daily_scalar_aggregates_v1/view.sql index 35129efe76..d82beb3a49 100644 --- a/sql/glam-fenix-dev/glam_etl/org_mozilla_fenix_glam_nightly__view_clients_daily_scalar_aggregates_v1/view.sql +++ b/sql/glam-fenix-dev/glam_etl/org_mozilla_fenix_glam_nightly__view_clients_daily_scalar_aggregates_v1/view.sql @@ -47,5 +47,4 @@ FROM with_build_hour JOIN with_geckoview_version_renamed -USING - (build_hour) + USING (build_hour) diff --git a/sql/moz-fx-cjms-nonprod-9a36/cjms_bigquery/refunds_v1/query.sql b/sql/moz-fx-cjms-nonprod-9a36/cjms_bigquery/refunds_v1/query.sql index a3fb565ee7..d33362f489 100644 --- a/sql/moz-fx-cjms-nonprod-9a36/cjms_bigquery/refunds_v1/query.sql +++ b/sql/moz-fx-cjms-nonprod-9a36/cjms_bigquery/refunds_v1/query.sql @@ -9,16 +9,13 @@ FROM `moz-fx-data-shared-prod`.stripe_external.nonprod_refund_v1 AS refund JOIN `moz-fx-data-shared-prod`.stripe_external.nonprod_charge_v1 AS charge -ON - refund.charge_id = charge.id + ON refund.charge_id = charge.id JOIN `moz-fx-data-shared-prod`.stripe_external.nonprod_invoice_v1 AS invoice -ON - charge.invoice_id = invoice.id + ON charge.invoice_id = invoice.id JOIN EXTERNAL_QUERY( "moz-fx-cjms-nonprod-9a36.us.cjms-sql", "SELECT subscription_id FROM subscriptions" ) -USING - (subscription_id) + USING (subscription_id) diff --git a/sql/moz-fx-cjms-nonprod-9a36/cjms_bigquery/subscriptions_v1/query.sql b/sql/moz-fx-cjms-nonprod-9a36/cjms_bigquery/subscriptions_v1/query.sql index 0dbd97885c..1a67399518 100644 --- a/sql/moz-fx-cjms-nonprod-9a36/cjms_bigquery/subscriptions_v1/query.sql +++ b/sql/moz-fx-cjms-nonprod-9a36/cjms_bigquery/subscriptions_v1/query.sql @@ -25,8 +25,7 @@ aic_flows AS ( flows_live JOIN EXTERNAL_QUERY("moz-fx-cjms-nonprod-9a36.us.cjms-sql", "SELECT flow_id FROM aic") - USING - (flow_id) + USING (flow_id) WHERE -- only use the last 10 days in stage submission_date >= CURRENT_DATE - 10 @@ -45,8 +44,7 @@ attributed_flows AS ( aic_flows JOIN `moz-fx-data-shared-prod`.subscription_platform_derived.nonprod_stripe_subscriptions_v1 AS subscriptions - ON - aic_flows.fxa_uid = subscriptions.fxa_uid + ON aic_flows.fxa_uid = subscriptions.fxa_uid AND aic_flows.flow_started < subscriptions.created GROUP BY subscription_id, @@ -72,8 +70,7 @@ initial_invoices AS ( attributed_subs JOIN `moz-fx-data-shared-prod`.stripe_external.nonprod_invoice_v1 AS invoices - USING - (subscription_id) + USING (subscription_id) QUALIFY 1 = ROW_NUMBER() OVER (PARTITION BY subscription_id ORDER BY invoices.created) ), @@ -87,16 +84,13 @@ initial_discounts AS ( initial_invoices JOIN `moz-fx-data-shared-prod`.stripe_external.nonprod_invoice_discount_v1 AS invoice_discounts - USING - (invoice_id) + USING (invoice_id) JOIN `moz-fx-data-shared-prod`.stripe_external.nonprod_promotion_code_v1 AS promotion_codes - ON - invoice_discounts.promotion_code = promotion_codes.id + ON invoice_discounts.promotion_code = promotion_codes.id JOIN `moz-fx-data-shared-prod`.stripe_external.nonprod_coupon_v1 AS coupons - ON - promotion_codes.coupon_id = coupons.id + ON promotion_codes.coupon_id = coupons.id ), promotion_codes AS ( SELECT @@ -127,8 +121,7 @@ percent_discounts AS ( initial_discounts AS discounts JOIN `moz-fx-data-shared-prod`.subscription_platform_derived.nonprod_stripe_subscriptions_v1 AS subscriptions - USING - (subscription_id) + USING (subscription_id) WHERE discounts.percent_off IS NOT NULL GROUP BY @@ -156,17 +149,13 @@ FROM attributed_subs JOIN `moz-fx-data-shared-prod`.subscription_platform_derived.nonprod_stripe_subscriptions_v1 AS subscriptions -USING - (subscription_id) + USING (subscription_id) LEFT JOIN promotion_codes -USING - (subscription_id) + USING (subscription_id) LEFT JOIN amount_discounts -USING - (subscription_id) + USING (subscription_id) LEFT JOIN percent_discounts -USING - (subscription_id, subscription_item_id) + USING (subscription_id, subscription_item_id) diff --git a/sql/moz-fx-cjms-prod-f3c7/cjms_bigquery/refunds_v1/query.sql b/sql/moz-fx-cjms-prod-f3c7/cjms_bigquery/refunds_v1/query.sql index b6b348a0fd..f743f53a20 100644 --- a/sql/moz-fx-cjms-prod-f3c7/cjms_bigquery/refunds_v1/query.sql +++ b/sql/moz-fx-cjms-prod-f3c7/cjms_bigquery/refunds_v1/query.sql @@ -9,13 +9,10 @@ FROM `moz-fx-data-shared-prod`.stripe_external.refund_v1 AS refund JOIN `moz-fx-data-shared-prod`.stripe_external.charge_v1 AS charge -ON - refund.charge_id = charge.id + ON refund.charge_id = charge.id JOIN `moz-fx-data-shared-prod`.stripe_external.invoice_v1 AS invoice -ON - charge.invoice_id = invoice.id + ON charge.invoice_id = invoice.id JOIN EXTERNAL_QUERY("moz-fx-cjms-prod-f3c7.us.cjms-sql", "SELECT subscription_id FROM subscriptions") -USING - (subscription_id) + USING (subscription_id) diff --git a/sql/moz-fx-cjms-prod-f3c7/cjms_bigquery/subscriptions_v1/query.sql b/sql/moz-fx-cjms-prod-f3c7/cjms_bigquery/subscriptions_v1/query.sql index e193b3fc8a..a0eca756cd 100644 --- a/sql/moz-fx-cjms-prod-f3c7/cjms_bigquery/subscriptions_v1/query.sql +++ b/sql/moz-fx-cjms-prod-f3c7/cjms_bigquery/subscriptions_v1/query.sql @@ -10,8 +10,7 @@ WITH aic_flows AS ( `moz-fx-cjms-prod-f3c7`.cjms_bigquery.flows_v1 JOIN EXTERNAL_QUERY("moz-fx-cjms-prod-f3c7.us.cjms-sql", "SELECT flow_id FROM aic") - USING - (flow_id) + USING (flow_id) WHERE -- use the last 31 days in prod submission_date >= CURRENT_DATE - 31 @@ -30,8 +29,7 @@ attributed_flows AS ( aic_flows JOIN `moz-fx-data-shared-prod`.subscription_platform_derived.stripe_subscriptions_v1 AS subscriptions - ON - aic_flows.fxa_uid = subscriptions.fxa_uid + ON aic_flows.fxa_uid = subscriptions.fxa_uid AND aic_flows.flow_started < subscriptions.created GROUP BY subscription_id, @@ -57,8 +55,7 @@ initial_invoices AS ( attributed_subs JOIN `moz-fx-data-shared-prod`.stripe_external.invoice_v1 AS invoices - USING - (subscription_id) + USING (subscription_id) QUALIFY 1 = ROW_NUMBER() OVER (PARTITION BY subscription_id ORDER BY invoices.created) ), @@ -72,16 +69,13 @@ initial_discounts AS ( initial_invoices JOIN `moz-fx-data-shared-prod`.stripe_external.invoice_discount_v1 AS invoice_discounts - USING - (invoice_id) + USING (invoice_id) JOIN `moz-fx-data-shared-prod`.stripe_external.promotion_code_v1 AS promotion_codes - ON - invoice_discounts.promotion_code = promotion_codes.id + ON invoice_discounts.promotion_code = promotion_codes.id JOIN `moz-fx-data-shared-prod`.stripe_external.coupon_v1 AS coupons - ON - promotion_codes.coupon_id = coupons.id + ON promotion_codes.coupon_id = coupons.id ), promotion_codes AS ( SELECT @@ -112,8 +106,7 @@ percent_discounts AS ( initial_discounts AS discounts JOIN `moz-fx-data-shared-prod`.subscription_platform_derived.stripe_subscriptions_v1 AS subscriptions - USING - (subscription_id) + USING (subscription_id) WHERE discounts.percent_off IS NOT NULL GROUP BY @@ -141,17 +134,13 @@ FROM attributed_subs JOIN `moz-fx-data-shared-prod`.subscription_platform_derived.stripe_subscriptions_v1 AS subscriptions -USING - (subscription_id) + USING (subscription_id) LEFT JOIN promotion_codes -USING - (subscription_id) + USING (subscription_id) LEFT JOIN amount_discounts -USING - (subscription_id) + USING (subscription_id) LEFT JOIN percent_discounts -USING - (subscription_id, subscription_item_id) + USING (subscription_id, subscription_item_id) diff --git a/sql/moz-fx-data-bq-performance/release_criteria/dashboard_health_v1/query.sql b/sql/moz-fx-data-bq-performance/release_criteria/dashboard_health_v1/query.sql index 7dd1c94bf6..074ed6d3e9 100644 --- a/sql/moz-fx-data-bq-performance/release_criteria/dashboard_health_v1/query.sql +++ b/sql/moz-fx-data-bq-performance/release_criteria/dashboard_health_v1/query.sql @@ -52,8 +52,7 @@ FROM distinct_rc FULL OUTER JOIN recent_tests -USING - (framework, platform, test_name, test_type, test_extra_options, subtest_name) + USING (framework, platform, test_name, test_type, test_extra_options, subtest_name) WHERE distinct_rc.rc_test_name IS NULL OR distinct_rc.defined_criteria > 1 diff --git a/sql/moz-fx-data-bq-performance/release_criteria/release_criteria_summary_v1/query.sql b/sql/moz-fx-data-bq-performance/release_criteria/release_criteria_summary_v1/query.sql index 0635af29f8..fcd8416a75 100644 --- a/sql/moz-fx-data-bq-performance/release_criteria/release_criteria_summary_v1/query.sql +++ b/sql/moz-fx-data-bq-performance/release_criteria/release_criteria_summary_v1/query.sql @@ -84,8 +84,14 @@ stage_2 AS ( WHERE STARTS_WITH(app_name, 'target') ) AS b - USING - (task_group_id, project, normalized_device_name, normalized_device_os, rc_tier, rc_test_name) + USING ( + task_group_id, + project, + normalized_device_name, + normalized_device_os, + rc_tier, + rc_test_name + ) WHERE NOT STARTS_WITH(app_name, 'target') ), diff --git a/sql/moz-fx-data-bq-performance/release_criteria/release_criteria_v1/query.sql b/sql/moz-fx-data-bq-performance/release_criteria/release_criteria_v1/query.sql index 991092cbb7..79250b2353 100644 --- a/sql/moz-fx-data-bq-performance/release_criteria/release_criteria_v1/query.sql +++ b/sql/moz-fx-data-bq-performance/release_criteria/release_criteria_v1/query.sql @@ -41,8 +41,7 @@ rc_test_data AS ( rc_flattened_test_data_v1 AS flattened LEFT JOIN rc_included_tests AS included_rc - ON - flattened.framework = included_rc.framework + ON flattened.framework = included_rc.framework AND flattened.platform = included_rc.platform AND flattened.normalized_test_type = included_rc.test_type AND flattened.test_name = included_rc.test_name @@ -298,8 +297,7 @@ rc_tests_with_tested_version AS ( rc_tests LEFT JOIN versions - ON - date_utc = DATE(task_group_time) + ON date_utc = DATE(task_group_time) AND ( (project IN ('fenix', 'mozilla-central', 'mozilla-beta', 'autoland') AND category = 'dev') OR (project = 'mozilla-release' AND category = 'stability') diff --git a/sql/moz-fx-data-marketing-prod/adjust_derived/firefox_mobile_installs_v1/query.sql b/sql/moz-fx-data-marketing-prod/adjust_derived/firefox_mobile_installs_v1/query.sql index fcb4da66b1..0474a684e0 100644 --- a/sql/moz-fx-data-marketing-prod/adjust_derived/firefox_mobile_installs_v1/query.sql +++ b/sql/moz-fx-data-marketing-prod/adjust_derived/firefox_mobile_installs_v1/query.sql @@ -14,8 +14,7 @@ FROM `ga-mozilla-org-prod-001.Adjust.deliverable_*` AS adjust LEFT JOIN `moz-fx-data-shared-prod.static.country_codes_v1` AS country -ON - UPPER(adjust.country) = country.code + ON UPPER(adjust.country) = country.code WHERE adjust.app = 'Firefox Android and iOS' AND adjust._TABLE_SUFFIX >= '20220101' diff --git a/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_app_referrer/query.sql b/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_app_referrer/query.sql index f34f53036b..c9a681b877 100644 --- a/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_app_referrer/query.sql +++ b/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_app_referrer/query.sql @@ -9,51 +9,39 @@ FROM `moz-fx-data-marketing-prod.apple_app_store_exported.active_devices_by_opt_in_app_referrer` FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.active_devices_last_30_days_by_opt_in_app_referrer` -USING - (date, app_name, app_referrer) + USING (date, app_name, app_referrer) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.app_units_by_app_referrer` -USING - (date, app_name, app_referrer) + USING (date, app_name, app_referrer) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.deletions_by_opt_in_app_referrer` -USING - (date, app_name, app_referrer) + USING (date, app_name, app_referrer) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.iap_by_app_referrer` -USING - (date, app_name, app_referrer) + USING (date, app_name, app_referrer) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.impressions_by_app_referrer` -USING - (date, app_name, app_referrer) + USING (date, app_name, app_referrer) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.impressions_unique_device_by_app_referrer` -USING - (date, app_name, app_referrer) + USING (date, app_name, app_referrer) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.installations_by_opt_in_app_referrer` -USING - (date, app_name, app_referrer) + USING (date, app_name, app_referrer) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.paying_users_by_app_referrer` -USING - (date, app_name, app_referrer) + USING (date, app_name, app_referrer) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.product_page_views_by_app_referrer` -USING - (date, app_name, app_referrer) + USING (date, app_name, app_referrer) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.product_page_views_unique_device_by_app_referrer` -USING - (date, app_name, app_referrer) + USING (date, app_name, app_referrer) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.sales_by_app_referrer` -USING - (date, app_name, app_referrer) + USING (date, app_name, app_referrer) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.sessions_by_opt_in_app_referrer` -USING - (date, app_name, app_referrer) + USING (date, app_name, app_referrer) WHERE date = @submission_date diff --git a/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_app_version/query.sql b/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_app_version/query.sql index b93a2bbcb5..11bc5ba10d 100644 --- a/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_app_version/query.sql +++ b/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_app_version/query.sql @@ -17,23 +17,18 @@ FROM `moz-fx-data-marketing-prod.apple_app_store_exported.active_devices_by_opt_in_app_version` FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.active_devices_last_30_days_by_opt_in_app_version` -USING - (date, app_name, app_version) + USING (date, app_name, app_version) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.crashes_by_opt_in_app_version` -USING - (date, app_name, app_version) + USING (date, app_name, app_version) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.deletions_by_opt_in_app_version` -USING - (date, app_name, app_version) + USING (date, app_name, app_version) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.installations_by_opt_in_app_version` -USING - (date, app_name, app_version) + USING (date, app_name, app_version) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.sessions_by_opt_in_app_version` -USING - (date, app_name, app_version) + USING (date, app_name, app_version) WHERE date = @submission_date diff --git a/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_campaign/query.sql b/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_campaign/query.sql index 4976340b6e..fc4bf07fd4 100644 --- a/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_campaign/query.sql +++ b/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_campaign/query.sql @@ -9,51 +9,39 @@ FROM `moz-fx-data-marketing-prod.apple_app_store_exported.active_devices_by_opt_in_campaign` FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.active_devices_last_30_days_by_opt_in_campaign` -USING - (date, app_name, campaign) + USING (date, app_name, campaign) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.app_units_by_campaign` -USING - (date, app_name, campaign) + USING (date, app_name, campaign) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.deletions_by_opt_in_campaign` -USING - (date, app_name, campaign) + USING (date, app_name, campaign) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.iap_by_campaign` -USING - (date, app_name, campaign) + USING (date, app_name, campaign) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.impressions_by_campaign` -USING - (date, app_name, campaign) + USING (date, app_name, campaign) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.impressions_unique_device_by_campaign` -USING - (date, app_name, campaign) + USING (date, app_name, campaign) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.installations_by_opt_in_campaign` -USING - (date, app_name, campaign) + USING (date, app_name, campaign) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.paying_users_by_campaign` -USING - (date, app_name, campaign) + USING (date, app_name, campaign) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.product_page_views_by_campaign` -USING - (date, app_name, campaign) + USING (date, app_name, campaign) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.product_page_views_unique_device_by_campaign` -USING - (date, app_name, campaign) + USING (date, app_name, campaign) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.sales_by_campaign` -USING - (date, app_name, campaign) + USING (date, app_name, campaign) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.sessions_by_opt_in_campaign` -USING - (date, app_name, campaign) + USING (date, app_name, campaign) WHERE date = @submission_date diff --git a/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_platform/query.sql b/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_platform/query.sql index ce4f6d35e1..bd5ace64ac 100644 --- a/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_platform/query.sql +++ b/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_platform/query.sql @@ -17,55 +17,42 @@ FROM `moz-fx-data-marketing-prod.apple_app_store_exported.active_devices_by_opt_in_platform` FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.active_devices_last_30_days_by_opt_in_platform` -USING - (date, app_name, platform) + USING (date, app_name, platform) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.app_units_by_platform` -USING - (date, app_name, platform) + USING (date, app_name, platform) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.crashes_by_opt_in_platform` -USING - (date, app_name, platform) + USING (date, app_name, platform) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.deletions_by_opt_in_platform` -USING - (date, app_name, platform) + USING (date, app_name, platform) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.iap_by_platform` -USING - (date, app_name, platform) + USING (date, app_name, platform) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.impressions_by_platform` -USING - (date, app_name, platform) + USING (date, app_name, platform) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.impressions_unique_device_by_platform` -USING - (date, app_name, platform) + USING (date, app_name, platform) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.installations_by_opt_in_platform` -USING - (date, app_name, platform) + USING (date, app_name, platform) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.paying_users_by_platform` -USING - (date, app_name, platform) + USING (date, app_name, platform) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.product_page_views_by_platform` -USING - (date, app_name, platform) + USING (date, app_name, platform) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.product_page_views_unique_device_by_platform` -USING - (date, app_name, platform) + USING (date, app_name, platform) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.sales_by_platform` -USING - (date, app_name, platform) + USING (date, app_name, platform) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.sessions_by_opt_in_platform` -USING - (date, app_name, platform) + USING (date, app_name, platform) WHERE date = @submission_date diff --git a/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_platform_version/query.sql b/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_platform_version/query.sql index d0d76a2c61..05834f6eec 100644 --- a/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_platform_version/query.sql +++ b/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_platform_version/query.sql @@ -17,55 +17,42 @@ FROM `moz-fx-data-marketing-prod.apple_app_store_exported.active_devices_by_opt_in_platform_version` FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.active_devices_last_30_days_by_opt_in_platform_version` -USING - (date, app_name, platform_version) + USING (date, app_name, platform_version) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.app_units_by_platform_version` -USING - (date, app_name, platform_version) + USING (date, app_name, platform_version) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.crashes_by_opt_in_platform_version` -USING - (date, app_name, platform_version) + USING (date, app_name, platform_version) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.deletions_by_opt_in_platform_version` -USING - (date, app_name, platform_version) + USING (date, app_name, platform_version) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.iap_by_platform_version` -USING - (date, app_name, platform_version) + USING (date, app_name, platform_version) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.impressions_by_platform_version` -USING - (date, app_name, platform_version) + USING (date, app_name, platform_version) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.impressions_unique_device_by_platform_version` -USING - (date, app_name, platform_version) + USING (date, app_name, platform_version) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.installations_by_opt_in_platform_version` -USING - (date, app_name, platform_version) + USING (date, app_name, platform_version) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.paying_users_by_platform_version` -USING - (date, app_name, platform_version) + USING (date, app_name, platform_version) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.product_page_views_by_platform_version` -USING - (date, app_name, platform_version) + USING (date, app_name, platform_version) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.product_page_views_unique_device_by_platform_version` -USING - (date, app_name, platform_version) + USING (date, app_name, platform_version) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.sales_by_platform_version` -USING - (date, app_name, platform_version) + USING (date, app_name, platform_version) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.sessions_by_opt_in_platform_version` -USING - (date, app_name, platform_version) + USING (date, app_name, platform_version) WHERE date = @submission_date diff --git a/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_region/query.sql b/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_region/query.sql index a8c463583c..095d9f9d0f 100644 --- a/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_region/query.sql +++ b/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_region/query.sql @@ -10,55 +10,42 @@ FROM `moz-fx-data-marketing-prod.apple_app_store_exported.active_devices_by_opt_in_region` FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.active_devices_last_30_days_by_opt_in_region` -USING - (date, app_name, region) + USING (date, app_name, region) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.app_units_by_region` -USING - (date, app_name, region) + USING (date, app_name, region) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.deletions_by_opt_in_region` -USING - (date, app_name, region) + USING (date, app_name, region) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.iap_by_region` -USING - (date, app_name, region) + USING (date, app_name, region) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.impressions_by_region` -USING - (date, app_name, region) + USING (date, app_name, region) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.impressions_unique_device_by_region` -USING - (date, app_name, region) + USING (date, app_name, region) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.installations_by_opt_in_region` -USING - (date, app_name, region) + USING (date, app_name, region) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.paying_users_by_region` -USING - (date, app_name, region) + USING (date, app_name, region) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.product_page_views_by_region` -USING - (date, app_name, region) + USING (date, app_name, region) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.product_page_views_unique_device_by_region` -USING - (date, app_name, region) + USING (date, app_name, region) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.rate_by_opt_in_region` -USING - (date, app_name, region) + USING (date, app_name, region) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.sales_by_region` -USING - (date, app_name, region) + USING (date, app_name, region) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.sessions_by_opt_in_region` -USING - (date, app_name, region) + USING (date, app_name, region) WHERE date = @submission_date diff --git a/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_source/query.sql b/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_source/query.sql index 9c29578d2a..de4011487c 100644 --- a/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_source/query.sql +++ b/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_source/query.sql @@ -9,51 +9,39 @@ FROM `moz-fx-data-marketing-prod.apple_app_store_exported.active_devices_by_opt_in_source` FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.active_devices_last_30_days_by_opt_in_source` -USING - (date, app_name, source) + USING (date, app_name, source) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.app_units_by_source` -USING - (date, app_name, source) + USING (date, app_name, source) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.deletions_by_opt_in_source` -USING - (date, app_name, source) + USING (date, app_name, source) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.iap_by_source` -USING - (date, app_name, source) + USING (date, app_name, source) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.impressions_by_source` -USING - (date, app_name, source) + USING (date, app_name, source) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.impressions_unique_device_by_source` -USING - (date, app_name, source) + USING (date, app_name, source) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.installations_by_opt_in_source` -USING - (date, app_name, source) + USING (date, app_name, source) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.paying_users_by_source` -USING - (date, app_name, source) + USING (date, app_name, source) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.product_page_views_by_source` -USING - (date, app_name, source) + USING (date, app_name, source) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.product_page_views_unique_device_by_source` -USING - (date, app_name, source) + USING (date, app_name, source) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.sales_by_source` -USING - (date, app_name, source) + USING (date, app_name, source) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.sessions_by_opt_in_source` -USING - (date, app_name, source) + USING (date, app_name, source) WHERE date = @submission_date diff --git a/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_storefront/query.sql b/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_storefront/query.sql index 42f4657022..e4a348c50f 100644 --- a/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_storefront/query.sql +++ b/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_storefront/query.sql @@ -10,55 +10,42 @@ FROM `moz-fx-data-marketing-prod.apple_app_store_exported.active_devices_by_opt_in_storefront` FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.active_devices_last_30_days_by_opt_in_storefront` -USING - (date, app_name, storefront) + USING (date, app_name, storefront) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.app_units_by_storefront` -USING - (date, app_name, storefront) + USING (date, app_name, storefront) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.deletions_by_opt_in_storefront` -USING - (date, app_name, storefront) + USING (date, app_name, storefront) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.iap_by_storefront` -USING - (date, app_name, storefront) + USING (date, app_name, storefront) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.impressions_by_storefront` -USING - (date, app_name, storefront) + USING (date, app_name, storefront) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.impressions_unique_device_by_storefront` -USING - (date, app_name, storefront) + USING (date, app_name, storefront) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.installations_by_opt_in_storefront` -USING - (date, app_name, storefront) + USING (date, app_name, storefront) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.paying_users_by_storefront` -USING - (date, app_name, storefront) + USING (date, app_name, storefront) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.product_page_views_by_storefront` -USING - (date, app_name, storefront) + USING (date, app_name, storefront) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.product_page_views_unique_device_by_storefront` -USING - (date, app_name, storefront) + USING (date, app_name, storefront) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.rate_by_opt_in_storefront` -USING - (date, app_name, storefront) + USING (date, app_name, storefront) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.sales_by_storefront` -USING - (date, app_name, storefront) + USING (date, app_name, storefront) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.sessions_by_opt_in_storefront` -USING - (date, app_name, storefront) + USING (date, app_name, storefront) WHERE date = @submission_date diff --git a/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_web_referrer/query.sql b/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_web_referrer/query.sql index e145dab2ef..011362d186 100644 --- a/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_web_referrer/query.sql +++ b/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_by_web_referrer/query.sql @@ -9,51 +9,39 @@ FROM `moz-fx-data-marketing-prod.apple_app_store_exported.active_devices_by_opt_in_web_referrer` FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.active_devices_last_30_days_by_opt_in_web_referrer` -USING - (date, app_name, web_referrer) + USING (date, app_name, web_referrer) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.app_units_by_web_referrer` -USING - (date, app_name, web_referrer) + USING (date, app_name, web_referrer) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.deletions_by_opt_in_web_referrer` -USING - (date, app_name, web_referrer) + USING (date, app_name, web_referrer) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.iap_by_web_referrer` -USING - (date, app_name, web_referrer) + USING (date, app_name, web_referrer) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.impressions_by_web_referrer` -USING - (date, app_name, web_referrer) + USING (date, app_name, web_referrer) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.impressions_unique_device_by_web_referrer` -USING - (date, app_name, web_referrer) + USING (date, app_name, web_referrer) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.installations_by_opt_in_web_referrer` -USING - (date, app_name, web_referrer) + USING (date, app_name, web_referrer) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.paying_users_by_web_referrer` -USING - (date, app_name, web_referrer) + USING (date, app_name, web_referrer) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.product_page_views_by_web_referrer` -USING - (date, app_name, web_referrer) + USING (date, app_name, web_referrer) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.product_page_views_unique_device_by_web_referrer` -USING - (date, app_name, web_referrer) + USING (date, app_name, web_referrer) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.sales_by_web_referrer` -USING - (date, app_name, web_referrer) + USING (date, app_name, web_referrer) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.sessions_by_opt_in_web_referrer` -USING - (date, app_name, web_referrer) + USING (date, app_name, web_referrer) WHERE date = @submission_date diff --git a/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_total/query.sql b/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_total/query.sql index ff5555b22c..6cb2473f57 100644 --- a/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_total/query.sql +++ b/sql/moz-fx-data-marketing-prod/apple_app_store/metrics_total/query.sql @@ -19,59 +19,45 @@ FROM `moz-fx-data-marketing-prod.apple_app_store_exported.active_devices_last_30_days_total` FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.active_devices_total` -USING - (date, app_name) + USING (date, app_name) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.app_units_total` -USING - (date, app_name) + USING (date, app_name) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.crashes_total` -USING - (date, app_name) + USING (date, app_name) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.deletions_total` -USING - (date, app_name) + USING (date, app_name) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.iap_total` -USING - (date, app_name) + USING (date, app_name) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.impressions_total` -USING - (date, app_name) + USING (date, app_name) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.impressions_unique_device_total` -USING - (date, app_name) + USING (date, app_name) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.installations_total` -USING - (date, app_name) + USING (date, app_name) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.paying_users_total` -USING - (date, app_name) + USING (date, app_name) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.product_page_views_total` -USING - (date, app_name) + USING (date, app_name) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.product_page_views_unique_device_total` -USING - (date, app_name) + USING (date, app_name) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.rate_total` -USING - (date, app_name) + USING (date, app_name) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.sales_total` -USING - (date, app_name) + USING (date, app_name) FULL JOIN `moz-fx-data-marketing-prod.apple_app_store_exported.sessions_total` -USING - (date, app_name) + USING (date, app_name) WHERE date = @submission_date diff --git a/sql/moz-fx-data-marketing-prod/fetch/fetch_deduped/view.sql b/sql/moz-fx-data-marketing-prod/fetch/fetch_deduped/view.sql index d9b82a21dd..2d6e583139 100644 --- a/sql/moz-fx-data-marketing-prod/fetch/fetch_deduped/view.sql +++ b/sql/moz-fx-data-marketing-prod/fetch/fetch_deduped/view.sql @@ -46,5 +46,4 @@ FROM LEFT JOIN -- Join metric / spend data to campaign information data latest_ingested_metrics AS metric -USING - (AdName) + USING (AdName) diff --git a/sql/moz-fx-data-marketing-prod/fetch/latest_spending/view.sql b/sql/moz-fx-data-marketing-prod/fetch/latest_spending/view.sql index 98c99326fe..bddf2a1079 100644 --- a/sql/moz-fx-data-marketing-prod/fetch/latest_spending/view.sql +++ b/sql/moz-fx-data-marketing-prod/fetch/latest_spending/view.sql @@ -7,5 +7,4 @@ FROM `moz-fx-data-marketing-prod.fetch.latest_trafficking` LEFT JOIN `moz-fx-data-marketing-prod.fetch.latest_metric` -USING - (fetch_id, AdName) + USING (fetch_id, AdName) diff --git a/sql/moz-fx-data-marketing-prod/fetch/spend_alignment_by_campaign_v1/query.sql b/sql/moz-fx-data-marketing-prod/fetch/spend_alignment_by_campaign_v1/query.sql index 7a4e86da53..6fc1441aae 100644 --- a/sql/moz-fx-data-marketing-prod/fetch/spend_alignment_by_campaign_v1/query.sql +++ b/sql/moz-fx-data-marketing-prod/fetch/spend_alignment_by_campaign_v1/query.sql @@ -25,7 +25,6 @@ FROM fetch_summary LEFT JOIN detailed_summary -USING - (campaign) + USING (campaign) ORDER BY fetch_summary_spend DESC diff --git a/sql/moz-fx-data-marketing-prod/fetch/spend_alignment_by_month_v1/query.sql b/sql/moz-fx-data-marketing-prod/fetch/spend_alignment_by_month_v1/query.sql index 4f38c93d54..1814db44a3 100644 --- a/sql/moz-fx-data-marketing-prod/fetch/spend_alignment_by_month_v1/query.sql +++ b/sql/moz-fx-data-marketing-prod/fetch/spend_alignment_by_month_v1/query.sql @@ -29,8 +29,7 @@ FROM fetch_summary LEFT JOIN detailed_summary -USING - (month, year) + USING (month, year) ORDER BY year, month diff --git a/sql/moz-fx-data-marketing-prod/ga_derived/blogs_daily_summary_v1/query.sql b/sql/moz-fx-data-marketing-prod/ga_derived/blogs_daily_summary_v1/query.sql index e543a0bf15..5cdf3bc7f1 100644 --- a/sql/moz-fx-data-marketing-prod/ga_derived/blogs_daily_summary_v1/query.sql +++ b/sql/moz-fx-data-marketing-prod/ga_derived/blogs_daily_summary_v1/query.sql @@ -20,12 +20,10 @@ FROM `moz-fx-data-marketing-prod.ga_derived.blogs_sessions_v1` AS sessions_table LEFT JOIN `moz-fx-data-marketing-prod.ga_derived.blogs_goals_v1` -USING - (date, visit_identifier) + USING (date, visit_identifier) LEFT JOIN `moz-fx-data-shared-prod.static.third_party_standardized_country_names` AS standardized_country_list -ON - sessions_table.country = standardized_country_list.raw_country + ON sessions_table.country = standardized_country_list.raw_country WHERE date = @submission_date GROUP BY diff --git a/sql/moz-fx-data-marketing-prod/ga_derived/blogs_landing_page_summary_v1/query.sql b/sql/moz-fx-data-marketing-prod/ga_derived/blogs_landing_page_summary_v1/query.sql index 460e2eded4..3fcdc44ff6 100644 --- a/sql/moz-fx-data-marketing-prod/ga_derived/blogs_landing_page_summary_v1/query.sql +++ b/sql/moz-fx-data-marketing-prod/ga_derived/blogs_landing_page_summary_v1/query.sql @@ -45,16 +45,13 @@ FROM `moz-fx-data-marketing-prod.ga_derived.blogs_sessions_v1` AS sessions_table LEFT JOIN `moz-fx-data-marketing-prod.ga_derived.blogs_goals_v1` AS goals_table -USING - (date, visit_identifier) + USING (date, visit_identifier) LEFT JOIN landing_page_table -USING - (date, visit_identifier) + USING (date, visit_identifier) LEFT JOIN `moz-fx-data-shared-prod.static.third_party_standardized_country_names` AS standardized_country_list -ON - sessions_table.country = standardized_country_list.raw_country + ON sessions_table.country = standardized_country_list.raw_country WHERE date = @submission_date GROUP BY diff --git a/sql/moz-fx-data-marketing-prod/ga_derived/downloads_with_attribution_v1/query.sql b/sql/moz-fx-data-marketing-prod/ga_derived/downloads_with_attribution_v1/query.sql index 98ba5bc85d..37b321dffa 100644 --- a/sql/moz-fx-data-marketing-prod/ga_derived/downloads_with_attribution_v1/query.sql +++ b/sql/moz-fx-data-marketing-prod/ga_derived/downloads_with_attribution_v1/query.sql @@ -101,12 +101,10 @@ ga_sessions_with_hits AS ( ga_sessions ga LEFT JOIN pageviews p - USING - (client_id, visit_id) + USING (client_id, visit_id) JOIN dl_events - USING - (client_id, visit_id) + USING (client_id, visit_id) ), stub_dl AS ( SELECT @@ -151,8 +149,7 @@ stub AS ( stub_dl JOIN stub_other_dl - USING - (stub_visit_id) + USING (stub_visit_id) ), -- This will drop all the ga_sessions w/o a DLtoken but keep DLtoken without a GA session. -- This will also result in multiple rows as the ga.client_id is not unique for the day @@ -189,8 +186,7 @@ downloads_and_ga_session AS ( ga_sessions_with_hits gs RIGHT JOIN stub s - ON - gs.client_id = s.stub_visit_id + ON gs.client_id = s.stub_visit_id GROUP BY gs.client_id, dltoken, @@ -341,5 +337,4 @@ FROM downloads_and_ga_session LEFT JOIN `moz-fx-data-shared-prod.static.country_names_v1` AS cn -ON - cn.name = country + ON cn.name = country diff --git a/sql/moz-fx-data-marketing-prod/ga_derived/downloads_with_attribution_v2/query.sql b/sql/moz-fx-data-marketing-prod/ga_derived/downloads_with_attribution_v2/query.sql index 666ad4b1dd..c804347d27 100644 --- a/sql/moz-fx-data-marketing-prod/ga_derived/downloads_with_attribution_v2/query.sql +++ b/sql/moz-fx-data-marketing-prod/ga_derived/downloads_with_attribution_v2/query.sql @@ -132,12 +132,10 @@ ga_sessions_with_hits_fields AS ( ga_session_dimensions ga LEFT JOIN page_hits p - USING - (client_id, visit_id) + USING (client_id, visit_id) JOIN event_hits - USING - (client_id, visit_id) + USING (client_id, visit_id) ), -- Extract all the download rows, de-duping and tracking number of duplicates per download token. stub_downloads AS ( @@ -180,8 +178,7 @@ stub_downloads_with_download_tracking AS ( stub_downloads s1 JOIN multiple_downloads_in_session s2 - ON - ( + ON ( s1.stub_visit_id = s2.stub_visit_id AND IFNULL(s1.stub_download_session_id, "null") = IFNULL(s2.stub_download_session_id, "null") ) @@ -221,8 +218,7 @@ downloads_with_ga_session AS ( ga_sessions_with_hits_fields gs RIGHT JOIN stub_downloads_with_download_tracking s - ON - (gs.client_id = s.stub_visit_id AND gs.download_session_id = s.stub_download_session_id) + ON (gs.client_id = s.stub_visit_id AND gs.download_session_id = s.stub_download_session_id) GROUP BY gs.client_id, dltoken, @@ -285,8 +281,7 @@ v2_table AS ( downloads_with_ga_session LEFT JOIN `moz-fx-data-shared-prod.static.country_names_v1` AS cn - ON - cn.name = country + ON cn.name = country ), -- Some of the joins for v2_table as not successful due to the GA data not including -- the download_session_id. The downloads which are unable to match to a GA session @@ -303,8 +298,7 @@ extract_dltoken_missing_ga_client AS ( v2_table v2 JOIN stub_downloads_with_download_tracking s - ON - (s.dltoken = v2.dltoken) + ON (s.dltoken = v2.dltoken) WHERE join_result_v2 = 'MISSING_GA_CLIENT_OR_SESSION_ID' ), @@ -338,8 +332,7 @@ v1_downloads_with_ga_session AS ( ga_sessions_with_hits_fields gs RIGHT JOIN extract_dltoken_missing_ga_client s - ON - gs.client_id = s.stub_visit_id + ON gs.client_id = s.stub_visit_id GROUP BY gs.client_id, stub_visit_id, @@ -387,8 +380,7 @@ v1_table AS ( v1_downloads_with_ga_session LEFT JOIN `moz-fx-data-shared-prod.static.country_names_v1` AS cn - ON - cn.name = country + ON cn.name = country ) SELECT * EXCEPT (join_result_v1), diff --git a/sql/moz-fx-data-marketing-prod/ga_derived/www_site_landing_page_metrics_v1/query.sql b/sql/moz-fx-data-marketing-prod/ga_derived/www_site_landing_page_metrics_v1/query.sql index d3e8a6b162..068c2c5cfd 100644 --- a/sql/moz-fx-data-marketing-prod/ga_derived/www_site_landing_page_metrics_v1/query.sql +++ b/sql/moz-fx-data-marketing-prod/ga_derived/www_site_landing_page_metrics_v1/query.sql @@ -115,16 +115,13 @@ joined_table AS ( sessions_table FULL JOIN `moz-fx-data-marketing-prod.ga_derived.www_site_downloads_v1` AS downloads_table - USING - (date, visit_identifier) + USING (date, visit_identifier) FULL JOIN pageviews_table - USING - (date, visit_identifier) + USING (date, visit_identifier) FULL JOIN bounces_table - USING - (date, visit_identifier) + USING (date, visit_identifier) WHERE -- To minimize table size, filtering for sessions != 0 sessions_table.sessions != 0 diff --git a/sql/moz-fx-data-marketing-prod/ga_derived/www_site_metrics_summary_v1/query.sql b/sql/moz-fx-data-marketing-prod/ga_derived/www_site_metrics_summary_v1/query.sql index 40d46bfb10..b36562fe79 100644 --- a/sql/moz-fx-data-marketing-prod/ga_derived/www_site_metrics_summary_v1/query.sql +++ b/sql/moz-fx-data-marketing-prod/ga_derived/www_site_metrics_summary_v1/query.sql @@ -79,8 +79,7 @@ site_data AS ( sessions_table LEFT JOIN download_aggregates - ON - sessions_table.date = download_aggregates.date + ON sessions_table.date = download_aggregates.date AND sessions_table.device_category = download_aggregates.device_category AND sessions_table.operating_system = download_aggregates.operating_system AND sessions_table.browser = download_aggregates.browser @@ -122,5 +121,4 @@ FROM site_data LEFT JOIN `moz-fx-data-shared-prod.static.third_party_standardized_country_names` AS standardized_country_list -ON - site_data.country = standardized_country_list.raw_country + ON site_data.country = standardized_country_list.raw_country diff --git a/sql/moz-fx-data-marketing-prod/ga_derived/www_site_metrics_summary_v2/query.sql b/sql/moz-fx-data-marketing-prod/ga_derived/www_site_metrics_summary_v2/query.sql index df6c180859..5a45906785 100644 --- a/sql/moz-fx-data-marketing-prod/ga_derived/www_site_metrics_summary_v2/query.sql +++ b/sql/moz-fx-data-marketing-prod/ga_derived/www_site_metrics_summary_v2/query.sql @@ -56,5 +56,4 @@ FROM site_data AS s LEFT JOIN `moz-fx-data-shared-prod.static.third_party_standardized_country_names` AS std_cntry_nms -ON - s.country = std_cntry_nms.raw_country + ON s.country = std_cntry_nms.raw_country diff --git a/sql/moz-fx-data-marketing-prod/iprospect/adspend_meta_v1/query.sql b/sql/moz-fx-data-marketing-prod/iprospect/adspend_meta_v1/query.sql index 7afff6ef51..f57c529f2f 100644 --- a/sql/moz-fx-data-marketing-prod/iprospect/adspend_meta_v1/query.sql +++ b/sql/moz-fx-data-marketing-prod/iprospect/adspend_meta_v1/query.sql @@ -49,8 +49,7 @@ FROM `moz-fx-data-marketing-prod.iprospect.adspend_raw_v1` today LEFT JOIN `moz-fx-data-marketing-prod.iprospect.adspend_raw_v1` yesterday -USING - (`date`, fetch_ad_name) + USING (`date`, fetch_ad_name) WHERE today.submission_date = @submission_date AND yesterday.submission_date = DATE_SUB(@submission_date, INTERVAL 1 DAY) diff --git a/sql/moz-fx-data-shared-prod/accounts_db_derived/accounts_aggregates_v1/query.sql b/sql/moz-fx-data-shared-prod/accounts_db_derived/accounts_aggregates_v1/query.sql index 9ed875cf69..8de292c575 100644 --- a/sql/moz-fx-data-shared-prod/accounts_db_derived/accounts_aggregates_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/accounts_db_derived/accounts_aggregates_v1/query.sql @@ -32,12 +32,10 @@ new_data AS ( `moz-fx-data-shared-prod.accounts_db_external.fxa_accounts_v1` a LEFT JOIN `moz-fx-data-shared-prod.accounts_db_external.fxa_totp_v1` t - USING - (uid) + USING (uid) LEFT JOIN `moz-fx-data-shared-prod.accounts_db_external.fxa_recovery_keys_v1` r - USING - (uid) + USING (uid) GROUP BY submission_date, active, diff --git a/sql/moz-fx-data-shared-prod/activity_stream/impression_stats_by_experiment/view.sql b/sql/moz-fx-data-shared-prod/activity_stream/impression_stats_by_experiment/view.sql index 9d19ccfdab..05d96e8a64 100644 --- a/sql/moz-fx-data-shared-prod/activity_stream/impression_stats_by_experiment/view.sql +++ b/sql/moz-fx-data-shared-prod/activity_stream/impression_stats_by_experiment/view.sql @@ -9,5 +9,4 @@ FROM `moz-fx-data-shared-prod.activity_stream_bi.impression_stats_by_experiment_v1` AS stats LEFT JOIN `moz-fx-data-shared-prod.pocket.spoc_tile_ids` AS spoc_tile_ids -USING - (tile_id) + USING (tile_id) diff --git a/sql/moz-fx-data-shared-prod/activity_stream/impression_stats_flat/view.sql b/sql/moz-fx-data-shared-prod/activity_stream/impression_stats_flat/view.sql index 2fa3a3d204..67ee3f2923 100755 --- a/sql/moz-fx-data-shared-prod/activity_stream/impression_stats_flat/view.sql +++ b/sql/moz-fx-data-shared-prod/activity_stream/impression_stats_flat/view.sql @@ -9,5 +9,4 @@ FROM `moz-fx-data-shared-prod.activity_stream_bi.impression_stats_flat_v1` AS stats LEFT JOIN `moz-fx-data-shared-prod.pocket.spoc_tile_ids` AS spoc_tile_ids -USING - (tile_id) + USING (tile_id) diff --git a/sql/moz-fx-data-shared-prod/ads_derived/nt_visits_to_sessions_conversion_factors_daily_v1/query.sql b/sql/moz-fx-data-shared-prod/ads_derived/nt_visits_to_sessions_conversion_factors_daily_v1/query.sql index e3ffdcbdc4..b6bbeacb1e 100644 --- a/sql/moz-fx-data-shared-prod/ads_derived/nt_visits_to_sessions_conversion_factors_daily_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/ads_derived/nt_visits_to_sessions_conversion_factors_daily_v1/query.sql @@ -83,8 +83,7 @@ FROM newtab_visits n_s INNER JOIN activity_stream a_s -USING - (submission_date, country) + USING (submission_date, country) ORDER BY country, submission_date diff --git a/sql/moz-fx-data-shared-prod/amo_dev/amo_stats_installs_v3/query.sql b/sql/moz-fx-data-shared-prod/amo_dev/amo_stats_installs_v3/query.sql index b8f1dfa39b..fc48425452 100644 --- a/sql/moz-fx-data-shared-prod/amo_dev/amo_stats_installs_v3/query.sql +++ b/sql/moz-fx-data-shared-prod/amo_dev/amo_stats_installs_v3/query.sql @@ -17,7 +17,6 @@ FROM -- approved for dev here. JOIN addon_id_lookup -USING - (hashed_addon_id) + USING (hashed_addon_id) WHERE submission_date = @submission_date diff --git a/sql/moz-fx-data-shared-prod/amo_prod/amo_stats_dau_v2/query.sql b/sql/moz-fx-data-shared-prod/amo_prod/amo_stats_dau_v2/query.sql index 88845eae37..84f74c8d61 100644 --- a/sql/moz-fx-data-shared-prod/amo_prod/amo_stats_dau_v2/query.sql +++ b/sql/moz-fx-data-shared-prod/amo_prod/amo_stats_dau_v2/query.sql @@ -196,25 +196,19 @@ FROM total_dau LEFT JOIN per_addon_version -USING - (submission_date, addon_id) + USING (submission_date, addon_id) LEFT JOIN per_app_version -USING - (submission_date, addon_id) + USING (submission_date, addon_id) LEFT JOIN per_fenix_build -USING - (submission_date, addon_id) + USING (submission_date, addon_id) LEFT JOIN per_locale -USING - (submission_date, addon_id) + USING (submission_date, addon_id) LEFT JOIN per_country -USING - (submission_date, addon_id) + USING (submission_date, addon_id) LEFT JOIN per_app_os -USING - (submission_date, addon_id) + USING (submission_date, addon_id) diff --git a/sql/moz-fx-data-shared-prod/amo_prod/amo_stats_installs_v3/query.sql b/sql/moz-fx-data-shared-prod/amo_prod/amo_stats_installs_v3/query.sql index 59c3067dd1..542441bfc9 100644 --- a/sql/moz-fx-data-shared-prod/amo_prod/amo_stats_installs_v3/query.sql +++ b/sql/moz-fx-data-shared-prod/amo_prod/amo_stats_installs_v3/query.sql @@ -135,17 +135,13 @@ FROM total_downloads LEFT JOIN per_source -USING - (submission_date, hashed_addon_id) + USING (submission_date, hashed_addon_id) LEFT JOIN per_content -USING - (submission_date, hashed_addon_id) + USING (submission_date, hashed_addon_id) LEFT JOIN per_medium -USING - (submission_date, hashed_addon_id) + USING (submission_date, hashed_addon_id) LEFT JOIN per_campaign -USING - (submission_date, hashed_addon_id) + USING (submission_date, hashed_addon_id) diff --git a/sql/moz-fx-data-shared-prod/amo_prod/desktop_addons_by_client_v1/query.sql b/sql/moz-fx-data-shared-prod/amo_prod/desktop_addons_by_client_v1/query.sql index bcf95ad8a3..0174a56ea9 100644 --- a/sql/moz-fx-data-shared-prod/amo_prod/desktop_addons_by_client_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/amo_prod/desktop_addons_by_client_v1/query.sql @@ -106,8 +106,7 @@ per_client AS ( per_clients_without_addons INNER JOIN per_clients_just_addons - USING - (submission_date, client_id, sample_id) + USING (submission_date, client_id, sample_id) ) SELECT * EXCEPT (addons), diff --git a/sql/moz-fx-data-shared-prod/contextual_services_derived/adm_forecasting_v1/query.sql b/sql/moz-fx-data-shared-prod/contextual_services_derived/adm_forecasting_v1/query.sql index ca027e492c..b37801dc2f 100644 --- a/sql/moz-fx-data-shared-prod/contextual_services_derived/adm_forecasting_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/contextual_services_derived/adm_forecasting_v1/query.sql @@ -96,8 +96,7 @@ client_share AS ( client_counts LEFT JOIN grand_total - USING - (submission_date, device) + USING (submission_date, device) WHERE device IS NOT NULL ), @@ -307,8 +306,7 @@ daily_mobile_clients AS ( ) ) ) - USING - (client_id) + USING (client_id) WHERE submission_date >= "2022-05-10" -- then mobile tiles went to default @@ -492,20 +490,16 @@ FROM population LEFT JOIN tiles_percentages pe -USING - (product, submission_date, country, device) + USING (product, submission_date, country, device) LEFT JOIN suggest_percentages -USING - (product, submission_date, country, device) + USING (product, submission_date, country, device) LEFT JOIN clicks c -USING - (product, submission_date, country, device) + USING (product, submission_date, country, device) LEFT JOIN client_share -USING - (device, country, submission_date) + USING (device, country, submission_date) WHERE submission_date = @submission_date ORDER BY diff --git a/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_check_v1/query.sql b/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_check_v1/query.sql index fb5546fdac..5400f95fef 100644 --- a/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_check_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_check_v1/query.sql @@ -37,8 +37,7 @@ partition_info AS ( OR (table_name = 'event_aggregates_spons_tiles_v1' AND total_rows > 0) OR (table_name = 'event_aggregates_suggest_v1' AND total_rows > 0) ) AS p - ON - date = PARSE_DATE('%Y%m%d', p.partition_id) + ON date = PARSE_DATE('%Y%m%d', p.partition_id) AND dates.table_name = p.table_name WHERE p.total_rows IS NULL diff --git a/sql/moz-fx-data-shared-prod/contextual_services_derived/request_payload_suggest_v2/query.sql b/sql/moz-fx-data-shared-prod/contextual_services_derived/request_payload_suggest_v2/query.sql index dc51e94450..8acbbd19d0 100644 --- a/sql/moz-fx-data-shared-prod/contextual_services_derived/request_payload_suggest_v2/query.sql +++ b/sql/moz-fx-data-shared-prod/contextual_services_derived/request_payload_suggest_v2/query.sql @@ -90,6 +90,5 @@ FROM quicksuggest qs LEFT JOIN ping_data pings -ON - qs.context_id = pings.context_id + ON qs.context_id = pings.context_id AND qs.interaction_type = pings.interaction_type diff --git a/sql/moz-fx-data-shared-prod/contextual_services_derived/suggest_revenue_levers_daily_v1/query.sql b/sql/moz-fx-data-shared-prod/contextual_services_derived/suggest_revenue_levers_daily_v1/query.sql index 86c98d0cee..fe1877210b 100644 --- a/sql/moz-fx-data-shared-prod/contextual_services_derived/suggest_revenue_levers_daily_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/contextual_services_derived/suggest_revenue_levers_daily_v1/query.sql @@ -153,20 +153,16 @@ FROM desktop_population LEFT JOIN client_shares -USING - (country, submission_date) + USING (country, submission_date) LEFT JOIN suggest_clients -USING - (submission_date, country) + USING (submission_date, country) LEFT JOIN urlbar_clients -USING - (submission_date, country) + USING (submission_date, country) LEFT JOIN grand_total -USING - (submission_date) + USING (submission_date) WHERE submission_date = @submission_date ORDER BY diff --git a/sql/moz-fx-data-shared-prod/domain_metadata_derived/top_domains_v1/query.sql b/sql/moz-fx-data-shared-prod/domain_metadata_derived/top_domains_v1/query.sql index 27abedf4b0..ed8b295d14 100644 --- a/sql/moz-fx-data-shared-prod/domain_metadata_derived/top_domains_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/domain_metadata_derived/top_domains_v1/query.sql @@ -37,8 +37,7 @@ host_join AS ( crux_country_summary c LEFT JOIN daily_tranco - USING - (host) + USING (host) ), domain_join AS ( SELECT @@ -53,8 +52,7 @@ domain_join AS ( (SELECT * FROM host_join WHERE host_rank IS NULL) h LEFT JOIN daily_tranco t - USING - (domain) + USING (domain) ), combined AS ( SELECT diff --git a/sql/moz-fx-data-shared-prod/fenix/attributable_clients_v2/view.sql b/sql/moz-fx-data-shared-prod/fenix/attributable_clients_v2/view.sql index 2f065a40fc..85e2b0b77f 100644 --- a/sql/moz-fx-data-shared-prod/fenix/attributable_clients_v2/view.sql +++ b/sql/moz-fx-data-shared-prod/fenix/attributable_clients_v2/view.sql @@ -37,9 +37,7 @@ FROM `moz-fx-data-shared-prod`.fenix_derived.attributable_clients_v2 JOIN `moz-fx-data-shared-prod`.fenix.firefox_android_clients -USING - (client_id) + USING (client_id) JOIN unfiltered_activations -USING - (client_id) + USING (client_id) diff --git a/sql/moz-fx-data-shared-prod/fenix/funnel_retention_clients/view.sql b/sql/moz-fx-data-shared-prod/fenix/funnel_retention_clients/view.sql index 1cd91ee4d4..d873d1a9b7 100644 --- a/sql/moz-fx-data-shared-prod/fenix/funnel_retention_clients/view.sql +++ b/sql/moz-fx-data-shared-prod/fenix/funnel_retention_clients/view.sql @@ -26,5 +26,4 @@ FROM `moz-fx-data-shared-prod.fenix_derived.funnel_retention_clients_week_2_v1` AS retention_week_2 FULL OUTER JOIN `moz-fx-data-shared-prod.fenix_derived.funnel_retention_clients_week_4_v1` AS retention_week_4 -USING - (first_seen_date, client_id, sample_id) + USING (first_seen_date, client_id, sample_id) diff --git a/sql/moz-fx-data-shared-prod/fenix_derived/attributable_clients_v1/init.sql b/sql/moz-fx-data-shared-prod/fenix_derived/attributable_clients_v1/init.sql index e3b908079c..fd9bf11a94 100755 --- a/sql/moz-fx-data-shared-prod/fenix_derived/attributable_clients_v1/init.sql +++ b/sql/moz-fx-data-shared-prod/fenix_derived/attributable_clients_v1/init.sql @@ -123,18 +123,14 @@ CLUSTER BY adjust_client JOIN client_day - USING - (client_id) + USING (client_id) FULL OUTER JOIN searches AS metrics_searches - USING - (client_id, submission_date) + USING (client_id, submission_date) JOIN first_seen - USING - (client_id) + USING (client_id) LEFT JOIN activations - USING - (client_id, submission_date) + USING (client_id, submission_date) ) diff --git a/sql/moz-fx-data-shared-prod/fenix_derived/attributable_clients_v1/query.sql b/sql/moz-fx-data-shared-prod/fenix_derived/attributable_clients_v1/query.sql index c7c88fbf38..1f7b559d76 100755 --- a/sql/moz-fx-data-shared-prod/fenix_derived/attributable_clients_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/fenix_derived/attributable_clients_v1/query.sql @@ -113,17 +113,13 @@ FROM adjust_client JOIN client_day -USING - (client_id) + USING (client_id) FULL OUTER JOIN searches AS metrics_searches -USING - (client_id, submission_date) + USING (client_id, submission_date) JOIN first_seen -USING - (client_id) + USING (client_id) LEFT JOIN activations -USING - (client_id, submission_date) + USING (client_id, submission_date) diff --git a/sql/moz-fx-data-shared-prod/fenix_derived/attributable_clients_v2/query.sql b/sql/moz-fx-data-shared-prod/fenix_derived/attributable_clients_v2/query.sql index f2fb8a4ff4..d0fcd58edf 100644 --- a/sql/moz-fx-data-shared-prod/fenix_derived/attributable_clients_v2/query.sql +++ b/sql/moz-fx-data-shared-prod/fenix_derived/attributable_clients_v2/query.sql @@ -104,9 +104,7 @@ FROM client_days FULL OUTER JOIN searches AS metrics_searches -USING - (client_id, sample_id, submission_date) + USING (client_id, sample_id, submission_date) FULL OUTER JOIN new_activations -USING - (client_id, sample_id, submission_date) + USING (client_id, sample_id, submission_date) diff --git a/sql/moz-fx-data-shared-prod/fenix_derived/client_adclicks_history_v1/query.sql b/sql/moz-fx-data-shared-prod/fenix_derived/client_adclicks_history_v1/query.sql index ffb7a16656..0dfb990c86 100644 --- a/sql/moz-fx-data-shared-prod/fenix_derived/client_adclicks_history_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/fenix_derived/client_adclicks_history_v1/query.sql @@ -25,5 +25,4 @@ FROM existing_data FULL OUTER JOIN new_data -USING - (sample_id, client_id) + USING (sample_id, client_id) diff --git a/sql/moz-fx-data-shared-prod/fenix_derived/clients_yearly_v1/query.sql b/sql/moz-fx-data-shared-prod/fenix_derived/clients_yearly_v1/query.sql index 5ef3a84b02..6b73dfc670 100755 --- a/sql/moz-fx-data-shared-prod/fenix_derived/clients_yearly_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/fenix_derived/clients_yearly_v1/query.sql @@ -50,7 +50,6 @@ FROM _current FULL OUTER JOIN _previous -USING -- Include sample_id to match the clustering of the tables, which may improve -- join performance. - (sample_id, client_id) + USING (sample_id, client_id) diff --git a/sql/moz-fx-data-shared-prod/fenix_derived/event_types_history_v1/init.sql b/sql/moz-fx-data-shared-prod/fenix_derived/event_types_history_v1/init.sql index 76bfb0f318..64dd0529a5 100644 --- a/sql/moz-fx-data-shared-prod/fenix_derived/event_types_history_v1/init.sql +++ b/sql/moz-fx-data-shared-prod/fenix_derived/event_types_history_v1/init.sql @@ -80,8 +80,7 @@ event_property_indices AS ( UNNEST(extra) AS event_property LEFT JOIN UNNEST(CAST(['time_ms'] AS ARRAY)) skipped_property - ON - skipped_property = event_property.key + ON skipped_property = event_property.key WHERE skipped_property IS NULL GROUP BY @@ -133,8 +132,7 @@ per_event_property AS ( event_property_value_indices INNER JOIN event_property_indices - USING - (category, event, event_property) + USING (category, event, event_property) WHERE event_property_value_index <= 1000 GROUP BY @@ -163,8 +161,7 @@ per_event AS ( primary_event_types LEFT JOIN per_event_property - USING - (category, event) + USING (category, event) GROUP BY category, event, diff --git a/sql/moz-fx-data-shared-prod/fenix_derived/event_types_history_v1/query.sql b/sql/moz-fx-data-shared-prod/fenix_derived/event_types_history_v1/query.sql index f5d420d22d..c1b4d674c0 100644 --- a/sql/moz-fx-data-shared-prod/fenix_derived/event_types_history_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/fenix_derived/event_types_history_v1/query.sql @@ -65,8 +65,7 @@ new_primary_event_types AS ( current_events LEFT JOIN event_types - USING - (category, event) + USING (category, event) WHERE event_types.event IS NULL GROUP BY @@ -114,16 +113,13 @@ new_event_property_indices AS ( UNNEST(extra) AS event_property LEFT JOIN (SELECT * FROM event_types, UNNEST(event_properties)) event_types - USING - (category, event, key) + USING (category, event, key) JOIN all_primary_event_types - USING - (event, category) + USING (event, category) LEFT JOIN UNNEST(CAST(['time_ms'] AS ARRAY)) skipped_property - ON - skipped_property = event_property.key + ON skipped_property = event_property.key WHERE skipped_property IS NULL AND event_types.event IS NULL @@ -186,15 +182,13 @@ new_event_property_value_indices AS ( UNNEST(event_properties) AS existing_event_property, UNNEST(value) AS `values` ) AS existing_event_type_values - ON - current_events.category = existing_event_type_values.category + ON current_events.category = existing_event_type_values.category AND current_events.event = existing_event_type_values.event AND event_property.key = existing_event_type_values.existing_event_property.key AND event_property.value = existing_event_type_values.`values`.key JOIN all_event_property_indices - ON - all_event_property_indices.category = current_events.category + ON all_event_property_indices.category = current_events.category AND all_event_property_indices.event = current_events.event AND all_event_property_indices.event_property = event_property.key WHERE @@ -244,8 +238,7 @@ per_event_property AS ( all_event_property_value_indices INNER JOIN all_event_property_indices - USING - (category, event, event_property) + USING (category, event, event_property) GROUP BY category, event, @@ -272,8 +265,7 @@ per_event AS ( all_primary_event_types LEFT JOIN per_event_property - USING - (category, event) + USING (category, event) GROUP BY category, event, diff --git a/sql/moz-fx-data-shared-prod/fenix_derived/events_daily_v1/query.sql b/sql/moz-fx-data-shared-prod/fenix_derived/events_daily_v1/query.sql index 1fed063dd8..b897f1a8d7 100644 --- a/sql/moz-fx-data-shared-prod/fenix_derived/events_daily_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/fenix_derived/events_daily_v1/query.sql @@ -119,8 +119,7 @@ joined AS ( events INNER JOIN fenix.event_types event_types - USING - (category, event) + USING (category, event) ) SELECT submission_date, diff --git a/sql/moz-fx-data-shared-prod/fenix_derived/feature_usage_events_v1/query.sql b/sql/moz-fx-data-shared-prod/fenix_derived/feature_usage_events_v1/query.sql index f01f543ddd..4e1c82df38 100644 --- a/sql/moz-fx-data-shared-prod/fenix_derived/feature_usage_events_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/fenix_derived/feature_usage_events_v1/query.sql @@ -944,5 +944,4 @@ FROM _events_ping_distinct_client_count LEFT JOIN product_features_agg -USING - (submission_date) + USING (submission_date) diff --git a/sql/moz-fx-data-shared-prod/fenix_derived/feature_usage_metrics_v1/query.sql b/sql/moz-fx-data-shared-prod/fenix_derived/feature_usage_metrics_v1/query.sql index afb95453af..dba31d7e19 100644 --- a/sql/moz-fx-data-shared-prod/fenix_derived/feature_usage_metrics_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/fenix_derived/feature_usage_metrics_v1/query.sql @@ -453,5 +453,4 @@ FROM _metrics_ping_distinct_client_count LEFT JOIN product_features_agg -USING - (submission_date) + USING (submission_date) diff --git a/sql/moz-fx-data-shared-prod/fenix_derived/firefox_android_clients_v1/init.sql b/sql/moz-fx-data-shared-prod/fenix_derived/firefox_android_clients_v1/init.sql index bd3d620fa0..b47149dafa 100644 --- a/sql/moz-fx-data-shared-prod/fenix_derived/firefox_android_clients_v1/init.sql +++ b/sql/moz-fx-data-shared-prod/fenix_derived/firefox_android_clients_v1/init.sql @@ -114,8 +114,7 @@ first_session_ping AS ( fenix.first_session AS fenix_first_session LEFT JOIN first_session_ping_min_seq - ON - ( + ON ( client_info.client_id = first_session_ping_min_seq.client_id AND ping_info.seq = first_session_ping_min_seq.seq AND fenix_first_session.sample_id = first_session_ping_min_seq.sample_id @@ -329,19 +328,15 @@ FROM first_seen FULL OUTER JOIN first_session_ping first_session -USING - (client_id) + USING (client_id) FULL OUTER JOIN metrics_ping AS metrics -USING - (client_id) + USING (client_id) FULL OUTER JOIN baseline_ping AS baseline -USING - (client_id) + USING (client_id) LEFT JOIN activations -USING - (client_id) + USING (client_id) WHERE client_id IS NOT NULL diff --git a/sql/moz-fx-data-shared-prod/fenix_derived/firefox_android_clients_v1/query.sql b/sql/moz-fx-data-shared-prod/fenix_derived/firefox_android_clients_v1/query.sql index fbc75b6511..65cecae9b8 100644 --- a/sql/moz-fx-data-shared-prod/fenix_derived/firefox_android_clients_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/fenix_derived/firefox_android_clients_v1/query.sql @@ -115,8 +115,7 @@ first_session_ping AS ( fenix.first_session AS fenix_first_session LEFT JOIN first_session_ping_min_seq - ON - ( + ON ( client_info.client_id = first_session_ping_min_seq.client_id AND ping_info.seq = first_session_ping_min_seq.seq AND fenix_first_session.sample_id = first_session_ping_min_seq.sample_id @@ -310,20 +309,16 @@ _current AS ( first_seen FULL OUTER JOIN first_session_ping first_session - USING - (client_id) + USING (client_id) FULL OUTER JOIN metrics_ping AS metrics - USING - (client_id) + USING (client_id) FULL OUTER JOIN baseline_ping AS baseline - USING - (client_id) + USING (client_id) FULL OUTER JOIN activations - USING - (client_id) + USING (client_id) WHERE client_id IS NOT NULL ), @@ -458,5 +453,4 @@ FROM _current FULL OUTER JOIN _previous -USING - (client_id) + USING (client_id) diff --git a/sql/moz-fx-data-shared-prod/fenix_derived/funnel_retention_clients_week_2_v1/query.sql b/sql/moz-fx-data-shared-prod/fenix_derived/funnel_retention_clients_week_2_v1/query.sql index 1d5851a9a9..abfe4c7e20 100755 --- a/sql/moz-fx-data-shared-prod/fenix_derived/funnel_retention_clients_week_2_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/fenix_derived/funnel_retention_clients_week_2_v1/query.sql @@ -37,8 +37,7 @@ retention_calculation AS ( clients_retention INNER JOIN clients_first_seen - USING - (client_id, sample_id) + USING (client_id, sample_id) ) SELECT @submission_date AS submission_date, diff --git a/sql/moz-fx-data-shared-prod/fenix_derived/funnel_retention_clients_week_4_v1/query.sql b/sql/moz-fx-data-shared-prod/fenix_derived/funnel_retention_clients_week_4_v1/query.sql index 40433ba13a..a4caa2b998 100755 --- a/sql/moz-fx-data-shared-prod/fenix_derived/funnel_retention_clients_week_4_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/fenix_derived/funnel_retention_clients_week_4_v1/query.sql @@ -38,8 +38,7 @@ retention_calculation AS ( clients_retention INNER JOIN clients_first_seen - USING - (client_id, sample_id) + USING (client_id, sample_id) ) SELECT @submission_date AS submission_date, diff --git a/sql/moz-fx-data-shared-prod/fenix_derived/google_ads_campaign_cost_breakdowns_v1/query.sql b/sql/moz-fx-data-shared-prod/fenix_derived/google_ads_campaign_cost_breakdowns_v1/query.sql index 8a362c0121..f9288cbd64 100644 --- a/sql/moz-fx-data-shared-prod/fenix_derived/google_ads_campaign_cost_breakdowns_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/fenix_derived/google_ads_campaign_cost_breakdowns_v1/query.sql @@ -15,8 +15,7 @@ WITH campaigns_with_persisted_ids AS ( `moz-fx-data-bq-fivetran`.google_ads.campaign_conversions_by_date JOIN `moz-fx-data-shared-prod`.google_ads_derived.campaign_names_map_v1 - USING - (campaign_id) + USING (campaign_id) GROUP BY date, campaign_name, @@ -105,12 +104,10 @@ FROM stats JOIN campaigns_with_persisted_ids -USING - (date, id) + USING (date, id) JOIN install_dou_metrics -ON - (stats.date = install_dou_metrics.date) + ON (stats.date = install_dou_metrics.date) AND ( campaigns_with_persisted_ids.fenix_compatible_campaign_name = install_dou_metrics.fenix_marketing_metrics_adjust_campaign ) diff --git a/sql/moz-fx-data-shared-prod/fenix_derived/ltv_states_v1/query.sql b/sql/moz-fx-data-shared-prod/fenix_derived/ltv_states_v1/query.sql index 0fcfa91df6..a59564923b 100644 --- a/sql/moz-fx-data-shared-prod/fenix_derived/ltv_states_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/fenix_derived/ltv_states_v1/query.sql @@ -50,12 +50,10 @@ FROM clients_yearly JOIN fenix.firefox_android_clients -USING - (sample_id, client_id) + USING (sample_id, client_id) LEFT JOIN fenix.client_adclicks_history -USING - (sample_id, client_id) + USING (sample_id, client_id) WHERE -- BrowserStack clients are bots, we don't want to accidentally report on them first_reported_isp != "BrowserStack" diff --git a/sql/moz-fx-data-shared-prod/fenix_derived/new_profile_activation_v1/query.sql b/sql/moz-fx-data-shared-prod/fenix_derived/new_profile_activation_v1/query.sql index cdd98c1508..ef1843c97e 100644 --- a/sql/moz-fx-data-shared-prod/fenix_derived/new_profile_activation_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/fenix_derived/new_profile_activation_v1/query.sql @@ -32,8 +32,7 @@ client_search AS ( `moz-fx-data-shared-prod.search_derived.mobile_search_clients_daily_v1` JOIN client_first_seen - USING - (client_id) + USING (client_id) WHERE (submission_date BETWEEN DATE_SUB(@submission_date, INTERVAL 3 DAY) AND @submission_date) AND normalized_app_name = 'Fenix' @@ -99,13 +98,10 @@ FROM dou INNER JOIN client_first_seen -USING - (client_id) + USING (client_id) LEFT JOIN client_search -USING - (client_id) + USING (client_id) LEFT JOIN adjust_client -USING - (client_id) + USING (client_id) diff --git a/sql/moz-fx-data-shared-prod/fenix_external/gplay_installs_by_country_v1/query.sql b/sql/moz-fx-data-shared-prod/fenix_external/gplay_installs_by_country_v1/query.sql index f83c2bf608..37d6cdb92a 100644 --- a/sql/moz-fx-data-shared-prod/fenix_external/gplay_installs_by_country_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/fenix_external/gplay_installs_by_country_v1/query.sql @@ -29,5 +29,4 @@ FROM app_data LEFT JOIN mozdata.static.country_codes_v1 AS country_details -USING - (code) + USING (code) diff --git a/sql/moz-fx-data-shared-prod/firefox_accounts/fxa_users_services_daily/view.sql b/sql/moz-fx-data-shared-prod/firefox_accounts/fxa_users_services_daily/view.sql index 5331a53ba7..623f41b881 100755 --- a/sql/moz-fx-data-shared-prod/firefox_accounts/fxa_users_services_daily/view.sql +++ b/sql/moz-fx-data-shared-prod/firefox_accounts/fxa_users_services_daily/view.sql @@ -8,8 +8,7 @@ FROM `moz-fx-data-shared-prod.firefox_accounts_derived.fxa_users_services_daily_v1` AS fxa LEFT JOIN `moz-fx-data-shared-prod.static.country_names_v1` AS cn -ON - cn.name = fxa.country + ON cn.name = fxa.country -- Once we move over to using v2 the below code should enable us -- to remain compatible with any downstream dependencies -- until downstream processes are updated diff --git a/sql/moz-fx-data-shared-prod/firefox_accounts/fxa_users_services_devices_daily/view.sql b/sql/moz-fx-data-shared-prod/firefox_accounts/fxa_users_services_devices_daily/view.sql index 14c609f27e..a1c32e98ec 100755 --- a/sql/moz-fx-data-shared-prod/firefox_accounts/fxa_users_services_devices_daily/view.sql +++ b/sql/moz-fx-data-shared-prod/firefox_accounts/fxa_users_services_devices_daily/view.sql @@ -8,5 +8,4 @@ FROM `moz-fx-data-shared-prod.firefox_accounts_derived.fxa_users_services_devices_daily_v1` AS fxa LEFT JOIN `moz-fx-data-shared-prod.static.country_names_v1` AS cn -ON - cn.name = fxa.country + ON cn.name = fxa.country diff --git a/sql/moz-fx-data-shared-prod/firefox_accounts/fxa_users_services_devices_last_seen/view.sql b/sql/moz-fx-data-shared-prod/firefox_accounts/fxa_users_services_devices_last_seen/view.sql index d417bdf63d..d132995c8f 100755 --- a/sql/moz-fx-data-shared-prod/firefox_accounts/fxa_users_services_devices_last_seen/view.sql +++ b/sql/moz-fx-data-shared-prod/firefox_accounts/fxa_users_services_devices_last_seen/view.sql @@ -9,5 +9,4 @@ FROM `moz-fx-data-shared-prod.firefox_accounts_derived.fxa_users_services_devices_last_seen_v1` AS fxa LEFT JOIN `moz-fx-data-shared-prod.static.country_names_v1` AS cn -ON - cn.name = fxa.country + ON cn.name = fxa.country diff --git a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/event_types_history_v1/init.sql b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/event_types_history_v1/init.sql index afd36653db..02dbf0a160 100644 --- a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/event_types_history_v1/init.sql +++ b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/event_types_history_v1/init.sql @@ -52,8 +52,7 @@ event_property_indices AS ( UNNEST(extra) AS event_property LEFT JOIN UNNEST(CAST([] AS ARRAY)) skipped_property - ON - skipped_property = event_property.key + ON skipped_property = event_property.key WHERE skipped_property IS NULL GROUP BY @@ -105,8 +104,7 @@ per_event_property AS ( event_property_value_indices INNER JOIN event_property_indices - USING - (category, event, event_property) + USING (category, event, event_property) WHERE event_property_value_index <= 1000 GROUP BY @@ -135,8 +133,7 @@ per_event AS ( primary_event_types LEFT JOIN per_event_property - USING - (category, event) + USING (category, event) GROUP BY category, event, diff --git a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/event_types_history_v1/query.sql b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/event_types_history_v1/query.sql index c1b3b2b08c..cb0f841108 100644 --- a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/event_types_history_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/event_types_history_v1/query.sql @@ -37,8 +37,7 @@ new_primary_event_types AS ( current_events LEFT JOIN event_types - USING - (category, event) + USING (category, event) WHERE event_types.event IS NULL GROUP BY @@ -86,16 +85,13 @@ new_event_property_indices AS ( UNNEST(extra) AS event_property LEFT JOIN (SELECT * FROM event_types, UNNEST(event_properties)) event_types - USING - (category, event, key) + USING (category, event, key) JOIN all_primary_event_types - USING - (event, category) + USING (event, category) LEFT JOIN UNNEST(CAST([] AS ARRAY)) skipped_property - ON - skipped_property = event_property.key + ON skipped_property = event_property.key WHERE skipped_property IS NULL AND event_types.event IS NULL @@ -158,15 +154,13 @@ new_event_property_value_indices AS ( UNNEST(event_properties) AS existing_event_property, UNNEST(value) AS `values` ) AS existing_event_type_values - ON - current_events.category = existing_event_type_values.category + ON current_events.category = existing_event_type_values.category AND current_events.event = existing_event_type_values.event AND event_property.key = existing_event_type_values.existing_event_property.key AND event_property.value = existing_event_type_values.`values`.key JOIN all_event_property_indices - ON - all_event_property_indices.category = current_events.category + ON all_event_property_indices.category = current_events.category AND all_event_property_indices.event = current_events.event AND all_event_property_indices.event_property = event_property.key WHERE @@ -216,8 +210,7 @@ per_event_property AS ( all_event_property_value_indices INNER JOIN all_event_property_indices - USING - (category, event, event_property) + USING (category, event, event_property) GROUP BY category, event, @@ -244,8 +237,7 @@ per_event AS ( all_primary_event_types LEFT JOIN per_event_property - USING - (category, event) + USING (category, event) GROUP BY category, event, diff --git a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/events_daily_v1/query.sql b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/events_daily_v1/query.sql index c6819fa3e1..aa9c3730de 100644 --- a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/events_daily_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/events_daily_v1/query.sql @@ -25,8 +25,7 @@ joined AS ( events INNER JOIN firefox_accounts.event_types event_types - USING - (category, event) + USING (category, event) ) SELECT submission_date, diff --git a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_amplitude_export_v1/query.sql b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_amplitude_export_v1/query.sql index 70466f6a78..f94fcf060a 100644 --- a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_amplitude_export_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_amplitude_export_v1/query.sql @@ -136,5 +136,4 @@ FROM grouped_by_user _current FULL OUTER JOIN _previous -USING - (user_id) + USING (user_id) diff --git a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_first_seen_v1/query.sql b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_first_seen_v1/query.sql index 3b2c3a71a2..0e3f3f2fe2 100644 --- a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_first_seen_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_first_seen_v1/query.sql @@ -40,5 +40,4 @@ FROM _previous FULL OUTER JOIN _current -USING - (user_id) + USING (user_id) diff --git a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_first_seen_v2/query.sql b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_first_seen_v2/query.sql index b9cd9ebde9..afdef001b4 100644 --- a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_first_seen_v2/query.sql +++ b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_first_seen_v2/query.sql @@ -30,7 +30,6 @@ FROM _current FULL OUTER JOIN _previous -USING - (user_id) + USING (user_id) WHERE _previous.user_id IS NULL diff --git a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_last_seen_v1/query.sql b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_last_seen_v1/query.sql index ad17fdf3f5..3666b3cbc6 100755 --- a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_last_seen_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_last_seen_v1/query.sql @@ -65,5 +65,4 @@ FROM _current FULL JOIN _previous -USING - (user_id) + USING (user_id) diff --git a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_last_seen_v2/query.sql b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_last_seen_v2/query.sql index 9221fb5ab2..1fba5c3ca6 100755 --- a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_last_seen_v2/query.sql +++ b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_last_seen_v2/query.sql @@ -53,5 +53,4 @@ FROM _current FULL JOIN _previous -USING - (user_id) + USING (user_id) diff --git a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_daily_v2/query.sql b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_daily_v2/query.sql index 633dcb5e1a..2bad6e8208 100755 --- a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_daily_v2/query.sql +++ b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_daily_v2/query.sql @@ -89,8 +89,7 @@ user_service_flow_entrypoints AS ( fxa_events JOIN flow_entrypoints - USING - (flow_id) + USING (flow_id) GROUP BY user_id, service @@ -129,8 +128,7 @@ user_service_utms AS ( fxa_events JOIN flow_utms - USING - (flow_id) + USING (flow_id) GROUP BY user_id, service @@ -196,12 +194,10 @@ FROM windowed LEFT JOIN user_service_flow_entrypoints -USING - (user_id, service) + USING (user_id, service) LEFT JOIN user_service_utms -USING - (user_id, service) + USING (user_id, service) WHERE user_id IS NOT NULL AND service IS NOT NULL diff --git a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_devices_daily_v1/query.sql b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_devices_daily_v1/query.sql index 10ac9b9b7d..c955090154 100644 --- a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_devices_daily_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_devices_daily_v1/query.sql @@ -123,12 +123,10 @@ FROM device_service_users_entries LEFT JOIN entrypoints -USING - (flow_id) + USING (flow_id) LEFT JOIN utms -USING - (flow_id) + USING (flow_id) WHERE -- making sure the user is registered user_id IS NOT NULL diff --git a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_devices_last_seen_v1/query.sql b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_devices_last_seen_v1/query.sql index d2ec8dfdb9..c6e5d4db2e 100644 --- a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_devices_last_seen_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_devices_last_seen_v1/query.sql @@ -53,8 +53,7 @@ combined AS ( _current FULL JOIN _previous - USING - (user_id, service, device_id) + USING (user_id, service, device_id) ) SELECT -- Retaining `timestamp` to represent when the last event took place diff --git a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_first_seen_v1/init.sql b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_first_seen_v1/init.sql index e30c08fa8b..af4f02e344 100755 --- a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_first_seen_v1/init.sql +++ b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_first_seen_v1/init.sql @@ -122,8 +122,7 @@ flows AS ( first_services_g s INNER JOIN fxa_content_auth_oauth AS f - ON - s.first_service_flow = f.flow_id + ON s.first_service_flow = f.flow_id WHERE f.entrypoint IS NOT NULL AND s.first_service_flow IS NOT NULL @@ -145,7 +144,6 @@ FROM first_services_g s LEFT JOIN flows f -USING - (first_service_flow) + USING (first_service_flow) WHERE first_service_flow IS NOT NULL diff --git a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_first_seen_v1/query.sql b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_first_seen_v1/query.sql index bbb85cf5b6..ccfcac874e 100755 --- a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_first_seen_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_first_seen_v1/query.sql @@ -114,8 +114,7 @@ flows AS ( first_services_g s INNER JOIN fxa_content_auth_oauth AS f - ON - s.first_service_flow = f.flow_id + ON s.first_service_flow = f.flow_id WHERE f.entrypoint IS NOT NULL AND s.first_service_flow IS NOT NULL @@ -137,7 +136,6 @@ FROM first_services_g s LEFT JOIN flows f -USING - (first_service_flow) + USING (first_service_flow) WHERE first_service_flow IS NOT NULL diff --git a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_first_seen_v2/query.sql b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_first_seen_v2/query.sql index e76ea1c8a5..337ea69ceb 100755 --- a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_first_seen_v2/query.sql +++ b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_first_seen_v2/query.sql @@ -50,8 +50,7 @@ FROM fxa_users_services_daily_new_entries AS new_entries FULL OUTER JOIN existing_entries -USING - (user_id, service) + USING (user_id, service) WHERE existing_entries.user_id IS NULL AND existing_entries.service IS NULL diff --git a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_last_seen_v1/query.sql b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_last_seen_v1/query.sql index da85d97ef6..cec92d1390 100755 --- a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_last_seen_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_last_seen_v1/query.sql @@ -54,8 +54,7 @@ combined AS ( _current FULL JOIN _previous - USING - (user_id, service) + USING (user_id, service) ), -- previously_seen AS ( @@ -85,9 +84,7 @@ FROM combined LEFT JOIN previously_seen AS same_service -USING - (user_id, service) + USING (user_id, service) LEFT JOIN previously_seen_users AS any_service -USING - (user_id) + USING (user_id) diff --git a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_last_seen_v2/query.sql b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_last_seen_v2/query.sql index 41fb87eae8..b534867300 100755 --- a/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_last_seen_v2/query.sql +++ b/sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_users_services_last_seen_v2/query.sql @@ -81,5 +81,4 @@ FROM _current FULL JOIN _previous -USING - (user_id, service) + USING (user_id, service) diff --git a/sql/moz-fx-data-shared-prod/firefox_desktop_derived/desktop_installs_v1/query.sql b/sql/moz-fx-data-shared-prod/firefox_desktop_derived/desktop_installs_v1/query.sql index 7c3b588538..2c8e570cca 100644 --- a/sql/moz-fx-data-shared-prod/firefox_desktop_derived/desktop_installs_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/firefox_desktop_derived/desktop_installs_v1/query.sql @@ -138,5 +138,4 @@ FROM install_ping LEFT JOIN download_token_info -USING - (dltoken) + USING (dltoken) diff --git a/sql/moz-fx-data-shared-prod/firefox_desktop_derived/review_checker_clients_v1/query.sql b/sql/moz-fx-data-shared-prod/firefox_desktop_derived/review_checker_clients_v1/query.sql index 5e55af65c5..7a9289d9a9 100644 --- a/sql/moz-fx-data-shared-prod/firefox_desktop_derived/review_checker_clients_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/firefox_desktop_derived/review_checker_clients_v1/query.sql @@ -104,13 +104,11 @@ joined_data AS ( shopping_metrics sm LEFT JOIN active_agg - ON - active_agg.client_id = sm.legacy_client_id + ON active_agg.client_id = sm.legacy_client_id AND active_agg.submission_date = sm.submission_date LEFT JOIN search AS s - ON - s.client_id = sm.legacy_client_id + ON s.client_id = sm.legacy_client_id AND s.submission_date = sm.submission_date ) SELECT diff --git a/sql/moz-fx-data-shared-prod/firefox_desktop_derived/review_checker_microsurvey_v1/query.sql b/sql/moz-fx-data-shared-prod/firefox_desktop_derived/review_checker_microsurvey_v1/query.sql index 08b418f87d..cb9d89638e 100644 --- a/sql/moz-fx-data-shared-prod/firefox_desktop_derived/review_checker_microsurvey_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/firefox_desktop_derived/review_checker_microsurvey_v1/query.sql @@ -71,8 +71,7 @@ filter_ms_microsurvey AS ( `moz-fx-data-shared-prod.firefox_desktop.messaging_system` msg LEFT JOIN `moz-fx-data-shared-prod.telemetry_derived.clients_first_seen_v2` cfs - ON - cfs.client_id = msg.metrics.uuid.messaging_system_client_id + ON cfs.client_id = msg.metrics.uuid.messaging_system_client_id WHERE DATE(submission_timestamp) = @submission_date AND metrics.string.messaging_system_ping_type IS NULL diff --git a/sql/moz-fx-data-shared-prod/firefox_ios/ad_activation_performance/view.sql b/sql/moz-fx-data-shared-prod/firefox_ios/ad_activation_performance/view.sql index a58a235326..bbda94dd6a 100644 --- a/sql/moz-fx-data-shared-prod/firefox_ios/ad_activation_performance/view.sql +++ b/sql/moz-fx-data-shared-prod/firefox_ios/ad_activation_performance/view.sql @@ -53,6 +53,5 @@ FROM ad_stats INNER JOIN client_activation_per_campaign -ON - ad_stats.date_day = client_activation_per_campaign.first_seen_date + ON ad_stats.date_day = client_activation_per_campaign.first_seen_date AND ad_stats.campaign_id = client_activation_per_campaign.campaign_id diff --git a/sql/moz-fx-data-shared-prod/firefox_ios/funnel_retention_clients/view.sql b/sql/moz-fx-data-shared-prod/firefox_ios/funnel_retention_clients/view.sql index 0dc3474964..92f197ba90 100644 --- a/sql/moz-fx-data-shared-prod/firefox_ios/funnel_retention_clients/view.sql +++ b/sql/moz-fx-data-shared-prod/firefox_ios/funnel_retention_clients/view.sql @@ -25,5 +25,4 @@ FROM `moz-fx-data-shared-prod.firefox_ios_derived.funnel_retention_clients_week_2_v1` AS retention_week_2 FULL OUTER JOIN `moz-fx-data-shared-prod.firefox_ios_derived.funnel_retention_clients_week_4_v1` AS retention_week_4 -USING - (first_seen_date, client_id, sample_id) + USING (first_seen_date, client_id, sample_id) diff --git a/sql/moz-fx-data-shared-prod/firefox_ios_derived/app_store_funnel_v1/query.sql b/sql/moz-fx-data-shared-prod/firefox_ios_derived/app_store_funnel_v1/query.sql index eb2347707c..49575e36c6 100755 --- a/sql/moz-fx-data-shared-prod/firefox_ios_derived/app_store_funnel_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/firefox_ios_derived/app_store_funnel_v1/query.sql @@ -40,12 +40,10 @@ store_stats AS ( views_data FULL OUTER JOIN downloads_data - USING - (`date`, country_name) + USING (`date`, country_name) LEFT JOIN static.country_names_v1 AS country_names - ON - country_names.name = views_data.country_name + ON country_names.name = views_data.country_name ), _new_profiles AS ( SELECT @@ -74,5 +72,4 @@ FROM store_stats FULL OUTER JOIN _new_profiles -USING - (`date`, country) + USING (`date`, country) diff --git a/sql/moz-fx-data-shared-prod/firefox_ios_derived/attributable_clients_v1/query.sql b/sql/moz-fx-data-shared-prod/firefox_ios_derived/attributable_clients_v1/query.sql index 35baa93018..94c3f4f7bf 100755 --- a/sql/moz-fx-data-shared-prod/firefox_ios_derived/attributable_clients_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/firefox_ios_derived/attributable_clients_v1/query.sql @@ -99,9 +99,7 @@ FROM client_days FULL OUTER JOIN metrics_searches -USING - (client_id, sample_id, submission_date) + USING (client_id, sample_id, submission_date) INNER JOIN adjust_client_info -USING - (client_id, sample_id) + USING (client_id, sample_id) diff --git a/sql/moz-fx-data-shared-prod/firefox_ios_derived/baseline_clients_yearly_v1/query.sql b/sql/moz-fx-data-shared-prod/firefox_ios_derived/baseline_clients_yearly_v1/query.sql index fd554da827..30556a1a4b 100644 --- a/sql/moz-fx-data-shared-prod/firefox_ios_derived/baseline_clients_yearly_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/firefox_ios_derived/baseline_clients_yearly_v1/query.sql @@ -72,7 +72,6 @@ FROM _current FULL JOIN _previous -USING - (client_id) + USING (client_id) {% endif %} diff --git a/sql/moz-fx-data-shared-prod/firefox_ios_derived/client_adclicks_history_v1/query.sql b/sql/moz-fx-data-shared-prod/firefox_ios_derived/client_adclicks_history_v1/query.sql index 2604275604..1c77b654a0 100644 --- a/sql/moz-fx-data-shared-prod/firefox_ios_derived/client_adclicks_history_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/firefox_ios_derived/client_adclicks_history_v1/query.sql @@ -25,5 +25,4 @@ FROM existing_data FULL OUTER JOIN new_data -USING - (sample_id, client_id) + USING (sample_id, client_id) diff --git a/sql/moz-fx-data-shared-prod/firefox_ios_derived/clients_activation_v1/query.sql b/sql/moz-fx-data-shared-prod/firefox_ios_derived/clients_activation_v1/query.sql index 74d95fa2fc..b414e3aa5b 100644 --- a/sql/moz-fx-data-shared-prod/firefox_ios_derived/clients_activation_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/firefox_ios_derived/clients_activation_v1/query.sql @@ -58,9 +58,7 @@ FROM new_clients LEFT JOIN new_clients_activity -USING - (client_id, first_seen_date, sample_id, channel) + USING (client_id, first_seen_date, sample_id, channel) LEFT JOIN clients_search -USING - (client_id, sample_id, channel) + USING (client_id, sample_id, channel) diff --git a/sql/moz-fx-data-shared-prod/firefox_ios_derived/feature_usage_events_v1/query.sql b/sql/moz-fx-data-shared-prod/firefox_ios_derived/feature_usage_events_v1/query.sql index 202fb38e5a..b63d98ba82 100644 --- a/sql/moz-fx-data-shared-prod/firefox_ios_derived/feature_usage_events_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/firefox_ios_derived/feature_usage_events_v1/query.sql @@ -387,5 +387,4 @@ FROM _events_ping_distinct_client_count JOIN product_features_agg -USING - (submission_date) + USING (submission_date) diff --git a/sql/moz-fx-data-shared-prod/firefox_ios_derived/feature_usage_metrics_v1/query.sql b/sql/moz-fx-data-shared-prod/firefox_ios_derived/feature_usage_metrics_v1/query.sql index c41fc3458c..9087baa3de 100644 --- a/sql/moz-fx-data-shared-prod/firefox_ios_derived/feature_usage_metrics_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/firefox_ios_derived/feature_usage_metrics_v1/query.sql @@ -450,5 +450,4 @@ FROM _metrics_ping_distinct_client_count JOIN product_features_agg -USING - (submission_date) + USING (submission_date) diff --git a/sql/moz-fx-data-shared-prod/firefox_ios_derived/firefox_ios_clients_v1/init.sql b/sql/moz-fx-data-shared-prod/firefox_ios_derived/firefox_ios_clients_v1/init.sql index f668784c5f..eea29045ea 100644 --- a/sql/moz-fx-data-shared-prod/firefox_ios_derived/firefox_ios_clients_v1/init.sql +++ b/sql/moz-fx-data-shared-prod/firefox_ios_derived/firefox_ios_clients_v1/init.sql @@ -148,12 +148,10 @@ _current AS ( first_seen FULL OUTER JOIN first_session_ping AS first_session - USING - (client_id, sample_id) + USING (client_id, sample_id) FULL OUTER JOIN metrics_ping AS metrics - USING - (client_id, sample_id) + USING (client_id, sample_id) WHERE client_id IS NOT NULL ) @@ -176,5 +174,4 @@ FROM _current LEFT JOIN activations -USING - (client_id) + USING (client_id) diff --git a/sql/moz-fx-data-shared-prod/firefox_ios_derived/firefox_ios_clients_v1/query.sql b/sql/moz-fx-data-shared-prod/firefox_ios_derived/firefox_ios_clients_v1/query.sql index 936b4794e9..a5a410b10d 100644 --- a/sql/moz-fx-data-shared-prod/firefox_ios_derived/firefox_ios_clients_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/firefox_ios_derived/firefox_ios_clients_v1/query.sql @@ -148,12 +148,10 @@ _current AS ( first_seen FULL OUTER JOIN first_session_ping AS first_session - USING - (client_id, sample_id) + USING (client_id, sample_id) FULL OUTER JOIN metrics_ping AS metrics - USING - (client_id, sample_id) + USING (client_id, sample_id) WHERE client_id IS NOT NULL ), @@ -215,9 +213,7 @@ FROM _current FULL OUTER JOIN _previous -USING - (client_id, sample_id) + USING (client_id, sample_id) LEFT JOIN activations -USING - (client_id) + USING (client_id) diff --git a/sql/moz-fx-data-shared-prod/firefox_ios_derived/funnel_retention_clients_week_2_v1/query.sql b/sql/moz-fx-data-shared-prod/firefox_ios_derived/funnel_retention_clients_week_2_v1/query.sql index 90dca20d36..901ac97656 100755 --- a/sql/moz-fx-data-shared-prod/firefox_ios_derived/funnel_retention_clients_week_2_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/firefox_ios_derived/funnel_retention_clients_week_2_v1/query.sql @@ -38,8 +38,7 @@ retention_calculation AS ( clients_retention INNER JOIN clients_first_seen - USING - (client_id, sample_id) + USING (client_id, sample_id) ) SELECT @submission_date AS submission_date, diff --git a/sql/moz-fx-data-shared-prod/firefox_ios_derived/funnel_retention_clients_week_4_v1/query.sql b/sql/moz-fx-data-shared-prod/firefox_ios_derived/funnel_retention_clients_week_4_v1/query.sql index 286d1ba639..0638488456 100755 --- a/sql/moz-fx-data-shared-prod/firefox_ios_derived/funnel_retention_clients_week_4_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/firefox_ios_derived/funnel_retention_clients_week_4_v1/query.sql @@ -39,8 +39,7 @@ retention_calculation AS ( clients_retention INNER JOIN clients_first_seen - USING - (client_id, sample_id) + USING (client_id, sample_id) ) SELECT @submission_date AS submission_date, diff --git a/sql/moz-fx-data-shared-prod/firefox_ios_derived/new_profile_activation_v1/query.sql b/sql/moz-fx-data-shared-prod/firefox_ios_derived/new_profile_activation_v1/query.sql index dd1713b575..f2209a6012 100644 --- a/sql/moz-fx-data-shared-prod/firefox_ios_derived/new_profile_activation_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/firefox_ios_derived/new_profile_activation_v1/query.sql @@ -32,8 +32,7 @@ client_search AS ( `moz-fx-data-shared-prod.search_derived.mobile_search_clients_daily_v1` JOIN client_first_seen - USING - (client_id) + USING (client_id) WHERE (submission_date BETWEEN DATE_SUB(@submission_date, INTERVAL 3 DAY) AND @submission_date) AND normalized_app_name = 'Fennec' @@ -76,9 +75,7 @@ FROM dou INNER JOIN client_first_seen -USING - (client_id) + USING (client_id) LEFT JOIN client_search -USING - (client_id) + USING (client_id) diff --git a/sql/moz-fx-data-shared-prod/firefox_ios_derived/new_profile_activation_v2/query.sql b/sql/moz-fx-data-shared-prod/firefox_ios_derived/new_profile_activation_v2/query.sql index 8026d012a9..25b2154704 100644 --- a/sql/moz-fx-data-shared-prod/firefox_ios_derived/new_profile_activation_v2/query.sql +++ b/sql/moz-fx-data-shared-prod/firefox_ios_derived/new_profile_activation_v2/query.sql @@ -57,11 +57,9 @@ FROM dou LEFT JOIN client_search -USING - (client_id) + USING (client_id) LEFT JOIN previous_client_entries -USING - (client_id) + USING (client_id) WHERE previous_client_entries.client_id IS NULL diff --git a/sql/moz-fx-data-shared-prod/fivetran_costs_derived/daily_connector_costs_v1/query.sql b/sql/moz-fx-data-shared-prod/fivetran_costs_derived/daily_connector_costs_v1/query.sql index bd937c13b1..9620aadfbf 100644 --- a/sql/moz-fx-data-shared-prod/fivetran_costs_derived/daily_connector_costs_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/fivetran_costs_derived/daily_connector_costs_v1/query.sql @@ -38,8 +38,7 @@ monthly_costs_per_mar AS ( monthly_paid_mar LEFT JOIN monthly_costs - USING - (destination_id, measured_month) + USING (destination_id, measured_month) ), daily_mar AS ( SELECT @@ -74,12 +73,10 @@ daily_connector_costs AS ( daily_mar LEFT JOIN monthly_costs_per_mar - USING - (destination_id, measured_month) + USING (destination_id, measured_month) LEFT JOIN destinations - USING - (destination_id) + USING (destination_id) ) SELECT * diff --git a/sql/moz-fx-data-shared-prod/fivetran_costs_derived/monthly_costs_v1/query.sql b/sql/moz-fx-data-shared-prod/fivetran_costs_derived/monthly_costs_v1/query.sql index 1ff0e860fc..1d80c39316 100644 --- a/sql/moz-fx-data-shared-prod/fivetran_costs_derived/monthly_costs_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/fivetran_costs_derived/monthly_costs_v1/query.sql @@ -32,8 +32,7 @@ monthly_costs AS ( monthly_costs_credits FULL OUTER JOIN monthly_costs_dollars - USING - (destination_id, measured_month) + USING (destination_id, measured_month) ) SELECT * diff --git a/sql/moz-fx-data-shared-prod/glam_etl/glam_desktop_beta_aggregates_v1/script.sql b/sql/moz-fx-data-shared-prod/glam_etl/glam_desktop_beta_aggregates_v1/script.sql index 159d266306..0ced30fcc9 100644 --- a/sql/moz-fx-data-shared-prod/glam_etl/glam_desktop_beta_aggregates_v1/script.sql +++ b/sql/moz-fx-data-shared-prod/glam_etl/glam_desktop_beta_aggregates_v1/script.sql @@ -3,10 +3,8 @@ -- https://docs.telemetry.mozilla.org/cookbooks/bigquery/querying.html MERGE INTO `moz-fx-data-glam-prod-fca7.glam_etl.glam_desktop_beta_aggregates_v1` T -USING - (SELECT * FROM `moz-fx-data-shared-prod.telemetry_derived.glam_extract_firefox_beta_v1`) S -ON - T.version = S.app_version + USING (SELECT * FROM `moz-fx-data-shared-prod.telemetry_derived.glam_extract_firefox_beta_v1`) S + ON T.version = S.app_version AND T.os = S.os AND T.build_id = S.app_build_id AND T.process = S.process diff --git a/sql/moz-fx-data-shared-prod/glam_etl/glam_desktop_nightly_aggregates_v1/script.sql b/sql/moz-fx-data-shared-prod/glam_etl/glam_desktop_nightly_aggregates_v1/script.sql index 87b6fa2dc1..2f48329ac6 100644 --- a/sql/moz-fx-data-shared-prod/glam_etl/glam_desktop_nightly_aggregates_v1/script.sql +++ b/sql/moz-fx-data-shared-prod/glam_etl/glam_desktop_nightly_aggregates_v1/script.sql @@ -3,10 +3,13 @@ -- https://docs.telemetry.mozilla.org/cookbooks/bigquery/querying.html MERGE INTO `moz-fx-data-glam-prod-fca7.glam_etl.glam_desktop_nightly_aggregates_v1` T -USING - (SELECT * FROM `moz-fx-data-shared-prod.telemetry_derived.glam_extract_firefox_nightly_v1`) S -ON - T.version = S.app_version + USING ( + SELECT + * + FROM + `moz-fx-data-shared-prod.telemetry_derived.glam_extract_firefox_nightly_v1` + ) S + ON T.version = S.app_version AND T.os = S.os AND T.build_id = S.app_build_id AND T.process = S.process diff --git a/sql/moz-fx-data-shared-prod/glam_etl/glam_desktop_release_aggregates_v1/script.sql b/sql/moz-fx-data-shared-prod/glam_etl/glam_desktop_release_aggregates_v1/script.sql index d9375da9cc..260576becd 100644 --- a/sql/moz-fx-data-shared-prod/glam_etl/glam_desktop_release_aggregates_v1/script.sql +++ b/sql/moz-fx-data-shared-prod/glam_etl/glam_desktop_release_aggregates_v1/script.sql @@ -3,10 +3,13 @@ -- https://docs.telemetry.mozilla.org/cookbooks/bigquery/querying.html MERGE INTO `moz-fx-data-glam-prod-fca7.glam_etl.glam_desktop_release_aggregates_v1` T -USING - (SELECT * FROM `moz-fx-data-shared-prod.telemetry_derived.glam_extract_firefox_release_v1`) S -ON - T.version = S.app_version + USING ( + SELECT + * + FROM + `moz-fx-data-shared-prod.telemetry_derived.glam_extract_firefox_release_v1` + ) S + ON T.version = S.app_version AND T.os = S.os AND T.build_id = S.app_build_id AND T.process = S.process diff --git a/sql/moz-fx-data-shared-prod/glam_etl/glam_fenix_beta_aggregates_v1/script.sql b/sql/moz-fx-data-shared-prod/glam_etl/glam_fenix_beta_aggregates_v1/script.sql index 31392b0617..bfea57452f 100644 --- a/sql/moz-fx-data-shared-prod/glam_etl/glam_fenix_beta_aggregates_v1/script.sql +++ b/sql/moz-fx-data-shared-prod/glam_etl/glam_fenix_beta_aggregates_v1/script.sql @@ -3,15 +3,13 @@ -- https://docs.telemetry.mozilla.org/cookbooks/bigquery/querying.html MERGE INTO `moz-fx-data-glam-prod-fca7.glam_etl.glam_fenix_beta_aggregates_v1` T -USING - ( + USING ( SELECT * FROM `moz-fx-data-glam-prod-fca7.glam_etl.org_mozilla_fenix_glam_beta__extract_probe_counts_v1` ) S -ON - T.version = S.version + ON T.version = S.version AND T.ping_type = S.ping_type AND T.os = S.os AND T.build_id = S.build_id diff --git a/sql/moz-fx-data-shared-prod/glam_etl/glam_fenix_nightly_aggregates_v1/script.sql b/sql/moz-fx-data-shared-prod/glam_etl/glam_fenix_nightly_aggregates_v1/script.sql index 3872973a84..5bb4fa8f0d 100644 --- a/sql/moz-fx-data-shared-prod/glam_etl/glam_fenix_nightly_aggregates_v1/script.sql +++ b/sql/moz-fx-data-shared-prod/glam_etl/glam_fenix_nightly_aggregates_v1/script.sql @@ -3,15 +3,13 @@ -- https://docs.telemetry.mozilla.org/cookbooks/bigquery/querying.html MERGE INTO `moz-fx-data-glam-prod-fca7.glam_etl.glam_fenix_nightly_aggregates_v1` T -USING - ( + USING ( SELECT * FROM `moz-fx-data-glam-prod-fca7.glam_etl.org_mozilla_fenix_glam_nightly__extract_probe_counts_v1` ) S -ON - T.version = S.version + ON T.version = S.version AND T.ping_type = S.ping_type AND T.os = S.os AND T.build_id = S.build_id diff --git a/sql/moz-fx-data-shared-prod/glam_etl/glam_fenix_release_aggregates_v1/script.sql b/sql/moz-fx-data-shared-prod/glam_etl/glam_fenix_release_aggregates_v1/script.sql index 0950989f50..1d69f0b024 100644 --- a/sql/moz-fx-data-shared-prod/glam_etl/glam_fenix_release_aggregates_v1/script.sql +++ b/sql/moz-fx-data-shared-prod/glam_etl/glam_fenix_release_aggregates_v1/script.sql @@ -3,15 +3,13 @@ -- https://docs.telemetry.mozilla.org/cookbooks/bigquery/querying.html MERGE INTO `moz-fx-data-glam-prod-fca7.glam_etl.glam_fenix_release_aggregates_v1` T -USING - ( + USING ( SELECT * FROM `moz-fx-data-glam-prod-fca7.glam_etl.org_mozilla_fenix_glam_release__extract_probe_counts_v1` ) S -ON - T.version = S.version + ON T.version = S.version AND T.ping_type = S.ping_type AND T.os = S.os AND T.build_id = S.build_id diff --git a/sql/moz-fx-data-shared-prod/glam_etl/glam_fog_beta_aggregates_v1/script.sql b/sql/moz-fx-data-shared-prod/glam_etl/glam_fog_beta_aggregates_v1/script.sql index 2640eec4f8..c9e9c6c50a 100644 --- a/sql/moz-fx-data-shared-prod/glam_etl/glam_fog_beta_aggregates_v1/script.sql +++ b/sql/moz-fx-data-shared-prod/glam_etl/glam_fog_beta_aggregates_v1/script.sql @@ -3,15 +3,13 @@ -- https://docs.telemetry.mozilla.org/cookbooks/bigquery/querying.html MERGE INTO `moz-fx-data-glam-prod-fca7.glam_etl.glam_fog_beta_aggregates_v1` T -USING - ( + USING ( SELECT * FROM `moz-fx-data-glam-prod-fca7.glam_etl.firefox_desktop_glam_beta__extract_probe_counts_v1` ) S -ON - T.version = S.version + ON T.version = S.version AND T.ping_type = S.ping_type AND T.os = S.os AND T.build_id = S.build_id diff --git a/sql/moz-fx-data-shared-prod/glam_etl/glam_fog_nightly_aggregates_v1/script.sql b/sql/moz-fx-data-shared-prod/glam_etl/glam_fog_nightly_aggregates_v1/script.sql index 73bb54b3c8..bc0290c715 100644 --- a/sql/moz-fx-data-shared-prod/glam_etl/glam_fog_nightly_aggregates_v1/script.sql +++ b/sql/moz-fx-data-shared-prod/glam_etl/glam_fog_nightly_aggregates_v1/script.sql @@ -3,15 +3,13 @@ -- https://docs.telemetry.mozilla.org/cookbooks/bigquery/querying.html MERGE INTO `moz-fx-data-glam-prod-fca7.glam_etl.glam_fog_nightly_aggregates_v1` T -USING - ( + USING ( SELECT * FROM `moz-fx-data-glam-prod-fca7.glam_etl.firefox_desktop_glam_nightly__extract_probe_counts_v1` ) S -ON - T.version = S.version + ON T.version = S.version AND T.ping_type = S.ping_type AND T.os = S.os AND T.build_id = S.build_id diff --git a/sql/moz-fx-data-shared-prod/glam_etl/glam_fog_release_aggregates_v1/script.sql b/sql/moz-fx-data-shared-prod/glam_etl/glam_fog_release_aggregates_v1/script.sql index e3a42e4fb8..8e4c10f361 100644 --- a/sql/moz-fx-data-shared-prod/glam_etl/glam_fog_release_aggregates_v1/script.sql +++ b/sql/moz-fx-data-shared-prod/glam_etl/glam_fog_release_aggregates_v1/script.sql @@ -3,15 +3,13 @@ -- https://docs.telemetry.mozilla.org/cookbooks/bigquery/querying.html MERGE INTO `moz-fx-data-glam-prod-fca7.glam_etl.glam_fog_release_aggregates_v1` T -USING - ( + USING ( SELECT * FROM `moz-fx-data-glam-prod-fca7.glam_etl.firefox_desktop_glam_release__extract_probe_counts_v1` ) S -ON - T.version = S.version + ON T.version = S.version AND T.ping_type = S.ping_type AND T.os = S.os AND T.build_id = S.build_id diff --git a/sql/moz-fx-data-shared-prod/google_ads_derived/campaign_conversions_by_date_v1/query.sql b/sql/moz-fx-data-shared-prod/google_ads_derived/campaign_conversions_by_date_v1/query.sql index 2f968d711f..8db273d65b 100644 --- a/sql/moz-fx-data-shared-prod/google_ads_derived/campaign_conversions_by_date_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/google_ads_derived/campaign_conversions_by_date_v1/query.sql @@ -24,5 +24,4 @@ FROM conversion_counts JOIN google_ads_derived.campaign_names_map_v1 -USING - (campaign_id, account_id) + USING (campaign_id, account_id) diff --git a/sql/moz-fx-data-shared-prod/google_ads_derived/campaign_names_map_v1/query.sql b/sql/moz-fx-data-shared-prod/google_ads_derived/campaign_names_map_v1/query.sql index e8a8b498e9..4edd6a2f0c 100644 --- a/sql/moz-fx-data-shared-prod/google_ads_derived/campaign_names_map_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/google_ads_derived/campaign_names_map_v1/query.sql @@ -17,7 +17,6 @@ FROM campaign_names JOIN google_ads_derived.accounts_v1 AS accounts -ON - accounts.account_id = campaign_names.customer_id + ON accounts.account_id = campaign_names.customer_id WHERE campaign_names.is_most_recent_record diff --git a/sql/moz-fx-data-shared-prod/hubs_derived/active_subscriptions_live/view.sql b/sql/moz-fx-data-shared-prod/hubs_derived/active_subscriptions_live/view.sql index d650787917..fc7a6be301 100644 --- a/sql/moz-fx-data-shared-prod/hubs_derived/active_subscriptions_live/view.sql +++ b/sql/moz-fx-data-shared-prod/hubs_derived/active_subscriptions_live/view.sql @@ -29,8 +29,7 @@ FROM subscriptions JOIN `moz-fx-data-shared-prod`.hubs.active_subscription_ids -USING - (subscription_id) + USING (subscription_id) GROUP BY active_date, plan_id, diff --git a/sql/moz-fx-data-shared-prod/hubs_derived/subscription_events_live/view.sql b/sql/moz-fx-data-shared-prod/hubs_derived/subscription_events_live/view.sql index 0d22ac86b2..98ce90b99d 100644 --- a/sql/moz-fx-data-shared-prod/hubs_derived/subscription_events_live/view.sql +++ b/sql/moz-fx-data-shared-prod/hubs_derived/subscription_events_live/view.sql @@ -122,8 +122,7 @@ FROM subscriptions JOIN events -USING - (subscription_id) + USING (subscription_id) GROUP BY event_date, event_type, diff --git a/sql/moz-fx-data-shared-prod/hubs_derived/subscriptions_v1/query.sql b/sql/moz-fx-data-shared-prod/hubs_derived/subscriptions_v1/query.sql index 74105a0422..95c5badfbf 100644 --- a/sql/moz-fx-data-shared-prod/hubs_derived/subscriptions_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/hubs_derived/subscriptions_v1/query.sql @@ -90,8 +90,7 @@ hubs_subscriptions AS ( stripe_subscriptions_history LEFT JOIN standardized_country - USING - (country) + USING (country) WHERE "managed-hubs" IN UNNEST(stripe_subscriptions_history.product_capabilities) OR "managed-hubs" IN UNNEST(stripe_subscriptions_history.plan_capabilities) diff --git a/sql/moz-fx-data-shared-prod/internet_outages/global_outages_v1/query.sql b/sql/moz-fx-data-shared-prod/internet_outages/global_outages_v1/query.sql index fbe3515246..dd734236f5 100644 --- a/sql/moz-fx-data-shared-prod/internet_outages/global_outages_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/internet_outages/global_outages_v1/query.sql @@ -206,8 +206,7 @@ final_health_data AS ( health_data_aggregates AS h INNER JOIN DAUs - USING - (datetime, country, city) + USING (datetime, country, city) ), -- Compute aggregates for histograms coming from the health ping. histogram_data_sample AS ( @@ -489,33 +488,25 @@ FROM -- are not accounted for in telemetry.clients_daily LEFT JOIN DAUs -USING - (datetime, country, city) + USING (datetime, country, city) LEFT JOIN dns_success_time AS ds -USING - (datetime, country, city) + USING (datetime, country, city) LEFT JOIN dns_no_dns_lookup_time AS ds_missing -USING - (datetime, country, city) + USING (datetime, country, city) LEFT JOIN dns_failure_time AS df -USING - (datetime, country, city) + USING (datetime, country, city) LEFT JOIN dns_failure_counts AS dfc -USING - (datetime, country, city) + USING (datetime, country, city) LEFT JOIN dns_no_dns_failure_time AS df_missing -USING - (datetime, country, city) + USING (datetime, country, city) LEFT JOIN tls_handshake_time AS tls -USING - (datetime, country, city) + USING (datetime, country, city) LEFT JOIN ssl_error_prop AS ssl -USING - (datetime, country, city) + USING (datetime, country, city) diff --git a/sql/moz-fx-data-shared-prod/messaging_system_derived/cfr_exact_mau28_by_dimensions_v1/query.sql b/sql/moz-fx-data-shared-prod/messaging_system_derived/cfr_exact_mau28_by_dimensions_v1/query.sql index e9e36d9c26..de8c1fb8f5 100644 --- a/sql/moz-fx-data-shared-prod/messaging_system_derived/cfr_exact_mau28_by_dimensions_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/messaging_system_derived/cfr_exact_mau28_by_dimensions_v1/query.sql @@ -15,8 +15,7 @@ FROM messaging_system.cfr_users_last_seen AS culs LEFT JOIN static.country_codes_v1 AS cc -ON - (culs.country = cc.code) + ON (culs.country = cc.code) WHERE (client_id IS NOT NULL OR impression_id IS NOT NULL) -- Reprocess all dates by running this query with --parameter=submission_date:DATE:NULL diff --git a/sql/moz-fx-data-shared-prod/messaging_system_derived/cfr_users_last_seen_v1/query.sql b/sql/moz-fx-data-shared-prod/messaging_system_derived/cfr_users_last_seen_v1/query.sql index e4f808e957..d6a0c26209 100644 --- a/sql/moz-fx-data-shared-prod/messaging_system_derived/cfr_users_last_seen_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/messaging_system_derived/cfr_users_last_seen_v1/query.sql @@ -44,5 +44,4 @@ FROM _current FULL JOIN _previous -USING - (_join_key) + USING (_join_key) diff --git a/sql/moz-fx-data-shared-prod/messaging_system_derived/event_types_history_v1/init.sql b/sql/moz-fx-data-shared-prod/messaging_system_derived/event_types_history_v1/init.sql index 46a02d09b2..d6aa9a78df 100644 --- a/sql/moz-fx-data-shared-prod/messaging_system_derived/event_types_history_v1/init.sql +++ b/sql/moz-fx-data-shared-prod/messaging_system_derived/event_types_history_v1/init.sql @@ -52,8 +52,7 @@ event_property_indices AS ( UNNEST(extra) AS event_property LEFT JOIN UNNEST(CAST([] AS ARRAY)) skipped_property - ON - skipped_property = event_property.key + ON skipped_property = event_property.key WHERE skipped_property IS NULL GROUP BY @@ -105,8 +104,7 @@ per_event_property AS ( event_property_value_indices INNER JOIN event_property_indices - USING - (category, event, event_property) + USING (category, event, event_property) WHERE event_property_value_index <= 1000 GROUP BY @@ -135,8 +133,7 @@ per_event AS ( primary_event_types LEFT JOIN per_event_property - USING - (category, event) + USING (category, event) GROUP BY category, event, diff --git a/sql/moz-fx-data-shared-prod/messaging_system_derived/event_types_history_v1/query.sql b/sql/moz-fx-data-shared-prod/messaging_system_derived/event_types_history_v1/query.sql index 82772365a5..de7eba0dac 100644 --- a/sql/moz-fx-data-shared-prod/messaging_system_derived/event_types_history_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/messaging_system_derived/event_types_history_v1/query.sql @@ -37,8 +37,7 @@ new_primary_event_types AS ( current_events LEFT JOIN event_types - USING - (category, event) + USING (category, event) WHERE event_types.event IS NULL GROUP BY @@ -86,16 +85,13 @@ new_event_property_indices AS ( UNNEST(extra) AS event_property LEFT JOIN (SELECT * FROM event_types, UNNEST(event_properties)) event_types - USING - (category, event, key) + USING (category, event, key) JOIN all_primary_event_types - USING - (event, category) + USING (event, category) LEFT JOIN UNNEST(CAST([] AS ARRAY)) skipped_property - ON - skipped_property = event_property.key + ON skipped_property = event_property.key WHERE skipped_property IS NULL AND event_types.event IS NULL @@ -158,15 +154,13 @@ new_event_property_value_indices AS ( UNNEST(event_properties) AS existing_event_property, UNNEST(value) AS `values` ) AS existing_event_type_values - ON - current_events.category = existing_event_type_values.category + ON current_events.category = existing_event_type_values.category AND current_events.event = existing_event_type_values.event AND event_property.key = existing_event_type_values.existing_event_property.key AND event_property.value = existing_event_type_values.`values`.key JOIN all_event_property_indices - ON - all_event_property_indices.category = current_events.category + ON all_event_property_indices.category = current_events.category AND all_event_property_indices.event = current_events.event AND all_event_property_indices.event_property = event_property.key WHERE @@ -216,8 +210,7 @@ per_event_property AS ( all_event_property_value_indices INNER JOIN all_event_property_indices - USING - (category, event, event_property) + USING (category, event, event_property) GROUP BY category, event, @@ -244,8 +237,7 @@ per_event AS ( all_primary_event_types LEFT JOIN per_event_property - USING - (category, event) + USING (category, event) GROUP BY category, event, diff --git a/sql/moz-fx-data-shared-prod/messaging_system_derived/events_daily_v1/query.sql b/sql/moz-fx-data-shared-prod/messaging_system_derived/events_daily_v1/query.sql index 2ec74dd4aa..196d540749 100644 --- a/sql/moz-fx-data-shared-prod/messaging_system_derived/events_daily_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/messaging_system_derived/events_daily_v1/query.sql @@ -25,8 +25,7 @@ joined AS ( events INNER JOIN messaging_system.event_types event_types - USING - (category, event) + USING (category, event) ) SELECT submission_date, diff --git a/sql/moz-fx-data-shared-prod/messaging_system_derived/onboarding_exact_mau28_by_dimensions_v1/query.sql b/sql/moz-fx-data-shared-prod/messaging_system_derived/onboarding_exact_mau28_by_dimensions_v1/query.sql index f14285ae71..f2a62225e5 100644 --- a/sql/moz-fx-data-shared-prod/messaging_system_derived/onboarding_exact_mau28_by_dimensions_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/messaging_system_derived/onboarding_exact_mau28_by_dimensions_v1/query.sql @@ -12,8 +12,7 @@ FROM messaging_system.onboarding_users_last_seen AS ouls LEFT JOIN static.country_codes_v1 AS cc -ON - (ouls.country = cc.code) + ON (ouls.country = cc.code) WHERE client_id IS NOT NULL -- Reprocess all dates by running this query with --parameter=submission_date:DATE:NULL diff --git a/sql/moz-fx-data-shared-prod/messaging_system_derived/onboarding_users_last_seen_v1/query.sql b/sql/moz-fx-data-shared-prod/messaging_system_derived/onboarding_users_last_seen_v1/query.sql index c2b1b173e6..5694ec2e6e 100644 --- a/sql/moz-fx-data-shared-prod/messaging_system_derived/onboarding_users_last_seen_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/messaging_system_derived/onboarding_users_last_seen_v1/query.sql @@ -33,5 +33,4 @@ FROM _current FULL JOIN _previous -USING - (client_id) + USING (client_id) diff --git a/sql/moz-fx-data-shared-prod/messaging_system_derived/snippets_exact_mau28_by_dimensions_v1/query.sql b/sql/moz-fx-data-shared-prod/messaging_system_derived/snippets_exact_mau28_by_dimensions_v1/query.sql index f13153af5f..22a2617142 100644 --- a/sql/moz-fx-data-shared-prod/messaging_system_derived/snippets_exact_mau28_by_dimensions_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/messaging_system_derived/snippets_exact_mau28_by_dimensions_v1/query.sql @@ -12,8 +12,7 @@ FROM messaging_system.snippets_users_last_seen AS suls LEFT JOIN static.country_codes_v1 AS cc -ON - (suls.country = cc.code) + ON (suls.country = cc.code) WHERE client_id IS NOT NULL -- Reprocess all dates by running this query with --parameter=submission_date:DATE:NULL diff --git a/sql/moz-fx-data-shared-prod/messaging_system_derived/snippets_users_last_seen_v1/query.sql b/sql/moz-fx-data-shared-prod/messaging_system_derived/snippets_users_last_seen_v1/query.sql index bbe3c28a8e..45900e95d1 100644 --- a/sql/moz-fx-data-shared-prod/messaging_system_derived/snippets_users_last_seen_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/messaging_system_derived/snippets_users_last_seen_v1/query.sql @@ -33,5 +33,4 @@ FROM _current FULL JOIN _previous -USING - (client_id) + USING (client_id) diff --git a/sql/moz-fx-data-shared-prod/monitoring/airflow_user/view.sql b/sql/moz-fx-data-shared-prod/monitoring/airflow_user/view.sql index 19c736b61e..485a8f8a85 100644 --- a/sql/moz-fx-data-shared-prod/monitoring/airflow_user/view.sql +++ b/sql/moz-fx-data-shared-prod/monitoring/airflow_user/view.sql @@ -23,7 +23,6 @@ FROM `moz-fx-data-shared-prod.monitoring_derived.airflow_user_v1` AS users LEFT JOIN user_role_mapping -USING - (role_id) + USING (role_id) WHERE active diff --git a/sql/moz-fx-data-shared-prod/monitoring/shredder_progress/view.sql b/sql/moz-fx-data-shared-prod/monitoring/shredder_progress/view.sql index 692f263620..cbd4deb3e7 100644 --- a/sql/moz-fx-data-shared-prod/monitoring/shredder_progress/view.sql +++ b/sql/moz-fx-data-shared-prod/monitoring/shredder_progress/view.sql @@ -33,8 +33,7 @@ WITH shredder AS ( `moz-fx-data-shredder.shredder_state.tasks` LEFT JOIN `moz-fx-data-shredder.shredder_state.shredder_state` - USING - (task_id, end_date) + USING (task_id, end_date) GROUP BY task_id, target, -- every task has exactly one target @@ -83,8 +82,7 @@ progress_by_target AS ( shredder LEFT JOIN successful_jobs - USING - (project_id, job_id) + USING (project_id, job_id) GROUP BY target, airflow_task_id, @@ -141,8 +139,7 @@ progress AS ( progress_by_target LEFT JOIN avg_bytes_per_slot_ms AS _ - USING - (airflow_task_id, end_date) + USING (airflow_task_id, end_date) GROUP BY airflow_task_id, end_date diff --git a/sql/moz-fx-data-shared-prod/monitoring_derived/airflow_user_v1/query.sql b/sql/moz-fx-data-shared-prod/monitoring_derived/airflow_user_v1/query.sql index 023a77e994..be0956f195 100644 --- a/sql/moz-fx-data-shared-prod/monitoring_derived/airflow_user_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/monitoring_derived/airflow_user_v1/query.sql @@ -9,8 +9,7 @@ FROM `moz-fx-data-bq-fivetran.telemetry_airflow_metadata_public.ab_user` AS user LEFT JOIN `moz-fx-data-bq-fivetran.telemetry_airflow_metadata_public.ab_user_role` AS user_role -ON - user.id = user_role.user_id + ON user.id = user_role.user_id WHERE NOT user._fivetran_deleted AND NOT user_role._fivetran_deleted diff --git a/sql/moz-fx-data-shared-prod/monitoring_derived/bigquery_usage_v2/query.sql b/sql/moz-fx-data-shared-prod/monitoring_derived/bigquery_usage_v2/query.sql index b7c7a8d912..57ccce9af3 100644 --- a/sql/moz-fx-data-shared-prod/monitoring_derived/bigquery_usage_v2/query.sql +++ b/sql/moz-fx-data-shared-prod/monitoring_derived/bigquery_usage_v2/query.sql @@ -103,8 +103,7 @@ FROM jobs_by_org AS jo LEFT JOIN jobs_by_project AS jp -USING - ( + USING ( source_project, creation_date, job_id, diff --git a/sql/moz-fx-data-shared-prod/monitoring_derived/deletion_request_volume_v2/script.sql b/sql/moz-fx-data-shared-prod/monitoring_derived/deletion_request_volume_v2/script.sql index 0ea2ca293a..92b322bd05 100644 --- a/sql/moz-fx-data-shared-prod/monitoring_derived/deletion_request_volume_v2/script.sql +++ b/sql/moz-fx-data-shared-prod/monitoring_derived/deletion_request_volume_v2/script.sql @@ -30,10 +30,8 @@ FOR; MERGE `moz-fx-data-shared-prod.monitoring_derived.deletion_request_volume_v2` r -USING - deletion_counts d -ON - d.submission_date = r.submission_date + USING deletion_counts d + ON d.submission_date = r.submission_date AND r.dataset_id = d.dataset_id WHEN NOT MATCHED THEN diff --git a/sql/moz-fx-data-shared-prod/monitoring_derived/shredder_rows_deleted_v1/query.py b/sql/moz-fx-data-shared-prod/monitoring_derived/shredder_rows_deleted_v1/query.py index 702785e1a8..d1d0424a7e 100644 --- a/sql/moz-fx-data-shared-prod/monitoring_derived/shredder_rows_deleted_v1/query.py +++ b/sql/moz-fx-data-shared-prod/monitoring_derived/shredder_rows_deleted_v1/query.py @@ -54,8 +54,7 @@ FROM shredder JOIN successful_jobs -USING - (project_id, job_id) + USING (project_id, job_id) """ parser = ArgumentParser() diff --git a/sql/moz-fx-data-shared-prod/monitoring_derived/structured_detailed_error_counts_v1/view.sql b/sql/moz-fx-data-shared-prod/monitoring_derived/structured_detailed_error_counts_v1/view.sql index f59ff355e8..7ad8e9af79 100755 --- a/sql/moz-fx-data-shared-prod/monitoring_derived/structured_detailed_error_counts_v1/view.sql +++ b/sql/moz-fx-data-shared-prod/monitoring_derived/structured_detailed_error_counts_v1/view.sql @@ -41,8 +41,7 @@ structured_detailed_hourly_errors AS ( `moz-fx-data-shared-prod.monitoring_derived.structured_error_counts_v1` structured_hourly_errors FULL OUTER JOIN error_examples - USING - (hour, document_namespace, document_type, document_version, error_type) + USING (hour, document_namespace, document_type, document_version, error_type) ), with_ratio AS ( SELECT diff --git a/sql/moz-fx-data-shared-prod/monitoring_derived/structured_error_counts_v2/script.sql b/sql/moz-fx-data-shared-prod/monitoring_derived/structured_error_counts_v2/script.sql index 42a4226466..4802883c35 100644 --- a/sql/moz-fx-data-shared-prod/monitoring_derived/structured_error_counts_v2/script.sql +++ b/sql/moz-fx-data-shared-prod/monitoring_derived/structured_error_counts_v2/script.sql @@ -84,15 +84,12 @@ FROM ping_counts FULL OUTER JOIN errors -USING - (submission_date, document_namespace, document_type, document_version); + USING (submission_date, document_namespace, document_type, document_version); MERGE `moz-fx-data-shared-prod.monitoring_derived.structured_error_counts_v2` r -USING - error_counts d -ON - d.submission_date = r.submission_date + USING error_counts d + ON d.submission_date = r.submission_date AND r.document_namespace = d.document_namespace AND r.document_type = d.document_type AND r.document_version = d.document_version diff --git a/sql/moz-fx-data-shared-prod/monitoring_derived/telemetry_missing_columns_v2/view.sql b/sql/moz-fx-data-shared-prod/monitoring_derived/telemetry_missing_columns_v2/view.sql index 17943c7896..e1b16df540 100755 --- a/sql/moz-fx-data-shared-prod/monitoring_derived/telemetry_missing_columns_v2/view.sql +++ b/sql/moz-fx-data-shared-prod/monitoring_derived/telemetry_missing_columns_v2/view.sql @@ -107,8 +107,7 @@ FROM reference FULL JOIN observed -USING - (document_namespace, document_type, document_version, path) + USING (document_namespace, document_type, document_version, path) ORDER BY document_namespace, document_type, diff --git a/sql/moz-fx-data-shared-prod/mozilla_org_derived/ga_clients_v1/query.sql b/sql/moz-fx-data-shared-prod/mozilla_org_derived/ga_clients_v1/query.sql index 98fc833c83..eeecd38717 100644 --- a/sql/moz-fx-data-shared-prod/mozilla_org_derived/ga_clients_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/mozilla_org_derived/ga_clients_v1/query.sql @@ -78,5 +78,4 @@ FROM historical_clients AS _previous FULL OUTER JOIN new_clients AS _current -USING - (ga_client_id) + USING (ga_client_id) diff --git a/sql/moz-fx-data-shared-prod/mozilla_org_derived/gclid_conversions_v1/query.sql b/sql/moz-fx-data-shared-prod/mozilla_org_derived/gclid_conversions_v1/query.sql index f6e2cc9677..9d42ae1396 100644 --- a/sql/moz-fx-data-shared-prod/mozilla_org_derived/gclid_conversions_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/mozilla_org_derived/gclid_conversions_v1/query.sql @@ -59,16 +59,13 @@ FROM gclids_to_ga_ids INNER JOIN ga_ids_to_dl_token -USING - (ga_client_id, stub_session_id) + USING (ga_client_id, stub_session_id) INNER JOIN dl_token_to_telemetry_id -USING - (dl_token) + USING (dl_token) INNER JOIN telemetry_id_to_activity -USING - (telemetry_client_id) + USING (telemetry_client_id) GROUP BY activity_date, gclid diff --git a/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/active_subscriptions_live/view.sql b/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/active_subscriptions_live/view.sql index 9ab42fc727..d5036a27dc 100644 --- a/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/active_subscriptions_live/view.sql +++ b/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/active_subscriptions_live/view.sql @@ -43,8 +43,7 @@ FROM all_subscriptions JOIN `moz-fx-data-shared-prod`.mozilla_vpn.active_subscription_ids -USING - (subscription_id) + USING (subscription_id) GROUP BY active_date, plan_id, diff --git a/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/all_subscriptions_v1/query.sql b/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/all_subscriptions_v1/query.sql index d032b6d147..9e64f92d3c 100644 --- a/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/all_subscriptions_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/all_subscriptions_v1/query.sql @@ -112,12 +112,10 @@ stripe_subscriptions AS ( stripe_subscriptions_history LEFT JOIN standardized_country - USING - (country) + USING (country) LEFT JOIN users - USING - (fxa_uid) + USING (fxa_uid) WHERE "guardian_vpn_1" IN UNNEST(stripe_subscriptions_history.product_capabilities) OR "guardian_vpn_1" IN UNNEST(stripe_subscriptions_history.plan_capabilities) @@ -173,8 +171,7 @@ apple_iap_subscriptions AS ( `moz-fx-data-shared-prod`.subscription_platform_derived.apple_subscriptions_v1 AS subplat LEFT JOIN users - USING - (fxa_uid) + USING (fxa_uid) WHERE subplat.product_id = "org.mozilla.ios.FirefoxVPN" AND subplat.fxa_uid IS NOT NULL @@ -243,12 +240,10 @@ google_iap_subscriptions AS ( `moz-fx-data-shared-prod`.subscription_platform_derived.google_subscriptions_v1 AS subscriptions LEFT JOIN standardized_country - USING - (country) + USING (country) LEFT JOIN users - USING - (fxa_uid) + USING (fxa_uid) WHERE subscriptions.product_id = "org.mozilla.firefox.vpn" ), @@ -283,8 +278,7 @@ subscription_last_touch_attributions AS ( all_subscriptions AS subscriptions JOIN fxa_attributions - ON - subscriptions.fxa_uid = fxa_attributions.fxa_uid + ON subscriptions.fxa_uid = fxa_attributions.fxa_uid AND COALESCE( subscriptions.original_subscription_start_date, subscriptions.subscription_start_date, @@ -314,8 +308,7 @@ all_subscriptions_with_attribution AS ( all_subscriptions AS subscriptions LEFT JOIN subscription_last_touch_attributions AS attributions - ON - subscriptions.subscription_id = attributions.subscription_id + ON subscriptions.subscription_id = attributions.subscription_id ), all_subscriptions_with_end_date AS ( SELECT diff --git a/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/event_types_history_v1/init.sql b/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/event_types_history_v1/init.sql index 29b4560d42..c7fb12375d 100644 --- a/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/event_types_history_v1/init.sql +++ b/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/event_types_history_v1/init.sql @@ -80,8 +80,7 @@ event_property_indices AS ( UNNEST(extra) AS event_property LEFT JOIN UNNEST(CAST(['time_ms'] AS ARRAY)) skipped_property - ON - skipped_property = event_property.key + ON skipped_property = event_property.key WHERE skipped_property IS NULL GROUP BY @@ -133,8 +132,7 @@ per_event_property AS ( event_property_value_indices INNER JOIN event_property_indices - USING - (category, event, event_property) + USING (category, event, event_property) WHERE event_property_value_index <= 1000 GROUP BY @@ -163,8 +161,7 @@ per_event AS ( primary_event_types LEFT JOIN per_event_property - USING - (category, event) + USING (category, event) GROUP BY category, event, diff --git a/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/event_types_history_v1/query.sql b/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/event_types_history_v1/query.sql index 466fd73c0d..e3599fb46d 100644 --- a/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/event_types_history_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/event_types_history_v1/query.sql @@ -65,8 +65,7 @@ new_primary_event_types AS ( current_events LEFT JOIN event_types - USING - (category, event) + USING (category, event) WHERE event_types.event IS NULL GROUP BY @@ -114,16 +113,13 @@ new_event_property_indices AS ( UNNEST(extra) AS event_property LEFT JOIN (SELECT * FROM event_types, UNNEST(event_properties)) event_types - USING - (category, event, key) + USING (category, event, key) JOIN all_primary_event_types - USING - (event, category) + USING (event, category) LEFT JOIN UNNEST(CAST(['time_ms'] AS ARRAY)) skipped_property - ON - skipped_property = event_property.key + ON skipped_property = event_property.key WHERE skipped_property IS NULL AND event_types.event IS NULL @@ -186,15 +182,13 @@ new_event_property_value_indices AS ( UNNEST(event_properties) AS existing_event_property, UNNEST(value) AS `values` ) AS existing_event_type_values - ON - current_events.category = existing_event_type_values.category + ON current_events.category = existing_event_type_values.category AND current_events.event = existing_event_type_values.event AND event_property.key = existing_event_type_values.existing_event_property.key AND event_property.value = existing_event_type_values.`values`.key JOIN all_event_property_indices - ON - all_event_property_indices.category = current_events.category + ON all_event_property_indices.category = current_events.category AND all_event_property_indices.event = current_events.event AND all_event_property_indices.event_property = event_property.key WHERE @@ -244,8 +238,7 @@ per_event_property AS ( all_event_property_value_indices INNER JOIN all_event_property_indices - USING - (category, event, event_property) + USING (category, event, event_property) GROUP BY category, event, @@ -272,8 +265,7 @@ per_event AS ( all_primary_event_types LEFT JOIN per_event_property - USING - (category, event) + USING (category, event) GROUP BY category, event, diff --git a/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/events_daily_v1/query.sql b/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/events_daily_v1/query.sql index 3eec2c937b..820381ce7f 100644 --- a/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/events_daily_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/events_daily_v1/query.sql @@ -113,8 +113,7 @@ joined AS ( events INNER JOIN mozilla_vpn.event_types event_types - USING - (category, event) + USING (category, event) ) SELECT submission_date, diff --git a/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/funnel_fxa_login_to_protected_v1/query.sql b/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/funnel_fxa_login_to_protected_v1/query.sql index 4d59c3235e..d1d8b61232 100644 --- a/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/funnel_fxa_login_to_protected_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/funnel_fxa_login_to_protected_v1/query.sql @@ -81,38 +81,39 @@ FROM fxa_login LEFT JOIN completed_login -ON - first_completed_login - BETWEEN first_fxa_login - AND TIMESTAMP_ADD(first_fxa_login, INTERVAL 2 DAY) + ON ( + first_completed_login + BETWEEN first_fxa_login + AND TIMESTAMP_ADD(first_fxa_login, INTERVAL 2 DAY) + ) AND fxa_login.fxa_uid = completed_login.fxa_uid LEFT JOIN registered_user -ON - first_registered_user - BETWEEN first_fxa_login - AND TIMESTAMP_ADD(first_fxa_login, INTERVAL 2 DAY) + ON ( + first_registered_user + BETWEEN first_fxa_login + AND TIMESTAMP_ADD(first_fxa_login, INTERVAL 2 DAY) + ) AND completed_login.fxa_uid = registered_user.fxa_uid LEFT JOIN paid_for_subscription -ON - first_paid_for_subscription - BETWEEN first_fxa_login - AND TIMESTAMP_ADD(first_fxa_login, INTERVAL 2 DAY) + ON ( + first_paid_for_subscription + BETWEEN first_fxa_login + AND TIMESTAMP_ADD(first_fxa_login, INTERVAL 2 DAY) + ) AND registered_user.fxa_uid = paid_for_subscription.fxa_uid LEFT JOIN registered_device -ON - first_registered_device - BETWEEN first_fxa_login - AND TIMESTAMP_ADD(first_fxa_login, INTERVAL 2 DAY) + ON ( + first_registered_device + BETWEEN first_fxa_login + AND TIMESTAMP_ADD(first_fxa_login, INTERVAL 2 DAY) + ) AND paid_for_subscription.fxa_uid = registered_device.fxa_uid LEFT JOIN protected -ON - first_protected - BETWEEN first_fxa_login - AND TIMESTAMP_ADD(first_fxa_login, INTERVAL 2 DAY) + ON (first_protected BETWEEN first_fxa_login AND TIMESTAMP_ADD(first_fxa_login, INTERVAL 2 DAY)) AND registered_device.fxa_uid = protected.fxa_uid WHERE DATE(first_fxa_login) >= '2020-05-01' diff --git a/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/funnel_ga_to_subscriptions_v1/query.sql b/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/funnel_ga_to_subscriptions_v1/query.sql index 25db1fd0aa..72bf17b3fb 100644 --- a/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/funnel_ga_to_subscriptions_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/funnel_ga_to_subscriptions_v1/query.sql @@ -135,5 +135,4 @@ FROM website FULL JOIN subscriptions -USING - (`date`, normalized_medium, normalized_source, normalized_campaign, normalized_content) + USING (`date`, normalized_medium, normalized_source, normalized_campaign, normalized_content) diff --git a/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/funnel_product_page_to_subscribed_v1/query.sql b/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/funnel_product_page_to_subscribed_v1/query.sql index 43468d9914..2fb8fe4171 100644 --- a/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/funnel_product_page_to_subscribed_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/funnel_product_page_to_subscribed_v1/query.sql @@ -15,8 +15,7 @@ WITH stripe_plans AS ( `moz-fx-data-shared-prod`.stripe_external.plan_v1 AS plans LEFT JOIN `moz-fx-data-shared-prod`.stripe_external.product_v1 AS products - ON - plans.product_id = products.id + ON plans.product_id = products.id ), events AS ( SELECT @@ -344,8 +343,7 @@ FROM flow_counts LEFT JOIN stripe_plans -USING - (plan_id) + USING (plan_id) WINDOW partition_date AS ( PARTITION BY diff --git a/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/guardian_apple_events_v1/query.sql b/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/guardian_apple_events_v1/query.sql index 5d9214ef86..0e340e0438 100644 --- a/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/guardian_apple_events_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/guardian_apple_events_v1/query.sql @@ -18,8 +18,7 @@ WITH legacy_subscriptions AS ( `moz-fx-data-shared-prod`.mozilla_vpn_external.subscriptions_20230117 AS subscriptions JOIN `moz-fx-data-shared-prod`.mozilla_vpn_external.users_v1 AS users - ON - (subscriptions.user_id = users.id) + ON (subscriptions.user_id = users.id) WHERE -- Subscriptions migrated to fxa no longer have subscriptions.provider = "APPLE" subscriptions.provider_receipt_json IS NOT NULL diff --git a/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/site_metrics_summary_v1/query.sql b/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/site_metrics_summary_v1/query.sql index a3a5a90d59..20d5d9d328 100644 --- a/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/site_metrics_summary_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/site_metrics_summary_v1/query.sql @@ -192,8 +192,7 @@ FROM sessions_table LEFT JOIN goals_table -USING - ( + USING ( `date`, device_category, operating_system, @@ -208,5 +207,4 @@ USING ) LEFT JOIN `moz-fx-data-shared-prod`.static.third_party_standardized_country_names -ON - sessions_table.country = third_party_standardized_country_names.raw_country + ON sessions_table.country = third_party_standardized_country_names.raw_country diff --git a/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/subscription_events_live/view.sql b/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/subscription_events_live/view.sql index f7e63fbe58..a3fb6bfd54 100644 --- a/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/subscription_events_live/view.sql +++ b/sql/moz-fx-data-shared-prod/mozilla_vpn_derived/subscription_events_live/view.sql @@ -136,8 +136,7 @@ FROM all_subscriptions JOIN events -USING - (subscription_id) + USING (subscription_id) GROUP BY event_date, event_type, diff --git a/sql/moz-fx-data-shared-prod/mozilla_vpn_external/devices_v1/query.sql b/sql/moz-fx-data-shared-prod/mozilla_vpn_external/devices_v1/query.sql index 9d92e434b4..0c1361bd4e 100644 --- a/sql/moz-fx-data-shared-prod/mozilla_vpn_external/devices_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/mozilla_vpn_external/devices_v1/query.sql @@ -11,5 +11,4 @@ FROM ) AS _update FULL JOIN devices_v1 -USING - (id) + USING (id) diff --git a/sql/moz-fx-data-shared-prod/mozilla_vpn_external/subscriptions_v1/query.sql b/sql/moz-fx-data-shared-prod/mozilla_vpn_external/subscriptions_v1/query.sql index 164e025f98..2844966a89 100644 --- a/sql/moz-fx-data-shared-prod/mozilla_vpn_external/subscriptions_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/mozilla_vpn_external/subscriptions_v1/query.sql @@ -11,5 +11,4 @@ FROM ) AS _update FULL JOIN subscriptions_v1 -USING - (id) + USING (id) diff --git a/sql/moz-fx-data-shared-prod/mozilla_vpn_external/users_v1/query.sql b/sql/moz-fx-data-shared-prod/mozilla_vpn_external/users_v1/query.sql index ca5fef1d5a..470bb0c664 100644 --- a/sql/moz-fx-data-shared-prod/mozilla_vpn_external/users_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/mozilla_vpn_external/users_v1/query.sql @@ -16,5 +16,4 @@ FROM ) AS _current FULL JOIN users_v1 AS _previous -USING - (id) + USING (id) diff --git a/sql/moz-fx-data-shared-prod/org_mozilla_fenix_derived/geckoview_version_v1/query.sql b/sql/moz-fx-data-shared-prod/org_mozilla_fenix_derived/geckoview_version_v1/query.sql index 9810ca97a8..4c03aa8491 100644 --- a/sql/moz-fx-data-shared-prod/org_mozilla_fenix_derived/geckoview_version_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/org_mozilla_fenix_derived/geckoview_version_v1/query.sql @@ -110,8 +110,7 @@ estimated_version AS ( top_build_hours RIGHT JOIN enumerated_build_hours - USING - (build_hour) + USING (build_hour) ) SELECT build_hour, diff --git a/sql/moz-fx-data-shared-prod/org_mozilla_fenix_derived/review_checker_clients_v1/query.sql b/sql/moz-fx-data-shared-prod/org_mozilla_fenix_derived/review_checker_clients_v1/query.sql index 2b7cc8ccb8..0c35cc4ade 100644 --- a/sql/moz-fx-data-shared-prod/org_mozilla_fenix_derived/review_checker_clients_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/org_mozilla_fenix_derived/review_checker_clients_v1/query.sql @@ -148,18 +148,15 @@ joined_data AS ( shopping_metrics sm LEFT JOIN active - ON - active.client_id = sm.client_id + ON active.client_id = sm.client_id AND active.submission_date = sm.submission_date LEFT JOIN search AS s - ON - s.client_id = sm.client_id + ON s.client_id = sm.client_id AND s.submission_date = sm.submission_date LEFT JOIN fx_dau - ON - fx_dau.client_id = sm.client_id + ON fx_dau.client_id = sm.client_id AND fx_dau.submission_date = sm.submission_date ) SELECT diff --git a/sql/moz-fx-data-shared-prod/org_mozilla_firefox_derived/incline_executive_v1/query.sql b/sql/moz-fx-data-shared-prod/org_mozilla_firefox_derived/incline_executive_v1/query.sql index 1901887a6f..98a963e431 100644 --- a/sql/moz-fx-data-shared-prod/org_mozilla_firefox_derived/incline_executive_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/org_mozilla_firefox_derived/incline_executive_v1/query.sql @@ -61,11 +61,10 @@ fennec_client_info AS ( telemetry_derived.core_clients_last_seen_v1 clients_last_seen LEFT JOIN org_mozilla_firefox.migrated_clients migrated_clients - ON -- For Fennec, we only want to look at historical migration pings -- to see if this client has migrated. We use this to check if they -- were migrated today as well. - clients_last_seen.client_id = migrated_clients.fennec_client_id + ON clients_last_seen.client_id = migrated_clients.fennec_client_id AND clients_last_seen.submission_date >= migrated_clients.submission_date WHERE clients_last_seen.submission_date IN ( @@ -100,10 +99,9 @@ fenix_client_info AS ( fenix_clients_last_seen clients_last_seen LEFT JOIN org_mozilla_firefox.migrated_clients migrated_clients - ON -- For Fenix, we don't care if there's a delay in the migration ping, we know they -- have been migrated the entire time - clients_last_seen.client_id = migrated_clients.fenix_client_id + ON clients_last_seen.client_id = migrated_clients.fenix_client_id WHERE clients_last_seen.submission_date = @submission_date ), @@ -235,8 +233,7 @@ last_year AS ( with_retention a INNER JOIN with_retention b - ON - DATE_SUB(a.date, INTERVAL 1 WEEK) = b.date + ON DATE_SUB(a.date, INTERVAL 1 WEEK) = b.date AND a.is_migrated = b.is_migrated AND a.app_name = b.app_name AND a.channel = b.channel @@ -280,13 +277,10 @@ FROM _current LEFT JOIN last_week -USING - (is_migrated, app_name, channel, manufacturer, country) + USING (is_migrated, app_name, channel, manufacturer, country) LEFT JOIN last_year -USING - (is_migrated, app_name, channel, manufacturer, country) + USING (is_migrated, app_name, channel, manufacturer, country) LEFT JOIN all_migrated_clients -USING - (app_name, channel, manufacturer, country) + USING (app_name, channel, manufacturer, country) diff --git a/sql/moz-fx-data-shared-prod/org_mozilla_ios_firefox_derived/legacy_metrics_v1/query.sql b/sql/moz-fx-data-shared-prod/org_mozilla_ios_firefox_derived/legacy_metrics_v1/query.sql index f8c80cb091..c9fe9d5c9a 100644 --- a/sql/moz-fx-data-shared-prod/org_mozilla_ios_firefox_derived/legacy_metrics_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/org_mozilla_ios_firefox_derived/legacy_metrics_v1/query.sql @@ -186,9 +186,7 @@ FROM aggregated FULL JOIN extracted_core t1 -USING - (client_id, submission_date) + USING (client_id, submission_date) FULL JOIN meta t2 -USING - (client_id, submission_date) + USING (client_id, submission_date) diff --git a/sql/moz-fx-data-shared-prod/org_mozilla_ios_firefox_derived/legacy_mobile_core_v1/query.sql b/sql/moz-fx-data-shared-prod/org_mozilla_ios_firefox_derived/legacy_mobile_core_v1/query.sql index 04fef5d3cb..5bcf53ab00 100644 --- a/sql/moz-fx-data-shared-prod/org_mozilla_ios_firefox_derived/legacy_mobile_core_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/org_mozilla_ios_firefox_derived/legacy_mobile_core_v1/query.sql @@ -72,5 +72,4 @@ FROM searches_grouped JOIN rest_grouped -USING - (submission_date, client_id) + USING (submission_date, client_id) diff --git a/sql/moz-fx-data-shared-prod/org_mozilla_ios_firefox_derived/legacy_mobile_core_v2/query.sql b/sql/moz-fx-data-shared-prod/org_mozilla_ios_firefox_derived/legacy_mobile_core_v2/query.sql index e45a45cea8..3da44a8aab 100644 --- a/sql/moz-fx-data-shared-prod/org_mozilla_ios_firefox_derived/legacy_mobile_core_v2/query.sql +++ b/sql/moz-fx-data-shared-prod/org_mozilla_ios_firefox_derived/legacy_mobile_core_v2/query.sql @@ -195,9 +195,7 @@ FROM searches_grouped JOIN rest_grouped -USING - (submission_date, client_id) + USING (submission_date, client_id) JOIN meta -USING - (submission_date, client_id) + USING (submission_date, client_id) diff --git a/sql/moz-fx-data-shared-prod/org_mozilla_ios_firefox_derived/legacy_mobile_event_counts_v1/query.sql b/sql/moz-fx-data-shared-prod/org_mozilla_ios_firefox_derived/legacy_mobile_event_counts_v1/query.sql index ae2d88bc3e..15ac571a7a 100644 --- a/sql/moz-fx-data-shared-prod/org_mozilla_ios_firefox_derived/legacy_mobile_event_counts_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/org_mozilla_ios_firefox_derived/legacy_mobile_event_counts_v1/query.sql @@ -69,5 +69,4 @@ FROM counts JOIN meta_recent -USING - (client_id, submission_date) + USING (client_id, submission_date) diff --git a/sql/moz-fx-data-shared-prod/org_mozilla_ios_firefox_derived/legacy_mobile_event_counts_v2/query.sql b/sql/moz-fx-data-shared-prod/org_mozilla_ios_firefox_derived/legacy_mobile_event_counts_v2/query.sql index 6e74184e6c..b8d1435876 100644 --- a/sql/moz-fx-data-shared-prod/org_mozilla_ios_firefox_derived/legacy_mobile_event_counts_v2/query.sql +++ b/sql/moz-fx-data-shared-prod/org_mozilla_ios_firefox_derived/legacy_mobile_event_counts_v2/query.sql @@ -205,5 +205,4 @@ FROM aggregated JOIN meta_recent -USING - (client_id, submission_date) + USING (client_id, submission_date) diff --git a/sql/moz-fx-data-shared-prod/org_mozilla_ios_firefox_derived/review_checker_clients_v1/query.sql b/sql/moz-fx-data-shared-prod/org_mozilla_ios_firefox_derived/review_checker_clients_v1/query.sql index 6d171feeef..fac5370dec 100644 --- a/sql/moz-fx-data-shared-prod/org_mozilla_ios_firefox_derived/review_checker_clients_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/org_mozilla_ios_firefox_derived/review_checker_clients_v1/query.sql @@ -149,18 +149,15 @@ joined_data AS ( shopping_metrics sm LEFT JOIN active - ON - active.client_id = sm.client_id + ON active.client_id = sm.client_id AND active.submission_date = sm.submission_date LEFT JOIN search AS s - ON - s.client_id = sm.client_id + ON s.client_id = sm.client_id AND s.submission_date = sm.submission_date LEFT JOIN fx_dau - ON - fx_dau.client_id = sm.client_id + ON fx_dau.client_id = sm.client_id AND fx_dau.submission_date = sm.submission_date ) SELECT diff --git a/sql/moz-fx-data-shared-prod/regrets_reporter_derived/regrets_reporter_summary_v1/init.sql b/sql/moz-fx-data-shared-prod/regrets_reporter_derived/regrets_reporter_summary_v1/init.sql index 3648d94932..dacb6cef15 100644 --- a/sql/moz-fx-data-shared-prod/regrets_reporter_derived/regrets_reporter_summary_v1/init.sql +++ b/sql/moz-fx-data-shared-prod/regrets_reporter_derived/regrets_reporter_summary_v1/init.sql @@ -70,10 +70,7 @@ wau_t AS ( dates_t INNER JOIN base_t - ON - date - BETWEEN DATE_SUB(dates_t.d, INTERVAL 6 DAY) - AND dates_t.d + ON (date BETWEEN DATE_SUB(dates_t.d, INTERVAL 6 DAY) AND dates_t.d) GROUP BY d, experiment_arm, @@ -138,9 +135,7 @@ FROM dau_t FULL JOIN wau_t -USING - (date, experiment_arm, ui_arm, country, browser, activities) + USING (date, experiment_arm, ui_arm, country, browser, activities) FULL JOIN new_user_t -USING - (date, experiment_arm, ui_arm, country, browser, activities) + USING (date, experiment_arm, ui_arm, country, browser, activities) diff --git a/sql/moz-fx-data-shared-prod/regrets_reporter_derived/regrets_reporter_summary_v1/query.sql b/sql/moz-fx-data-shared-prod/regrets_reporter_derived/regrets_reporter_summary_v1/query.sql index a90e87036a..92a7271dcb 100644 --- a/sql/moz-fx-data-shared-prod/regrets_reporter_derived/regrets_reporter_summary_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/regrets_reporter_derived/regrets_reporter_summary_v1/query.sql @@ -60,10 +60,7 @@ wau_t AS ( dates_t INNER JOIN base_t - ON - date - BETWEEN DATE_SUB(dates_t.d, INTERVAL 6 DAY) - AND dates_t.d + ON (date BETWEEN DATE_SUB(dates_t.d, INTERVAL 6 DAY) AND dates_t.d) GROUP BY d, experiment_arm, @@ -128,9 +125,7 @@ FROM dau_t FULL JOIN wau_t -USING - (date, experiment_arm, ui_arm, country, browser, activities) + USING (date, experiment_arm, ui_arm, country, browser, activities) FULL JOIN new_user_t -USING - (date, experiment_arm, ui_arm, country, browser, activities) + USING (date, experiment_arm, ui_arm, country, browser, activities) diff --git a/sql/moz-fx-data-shared-prod/relay_derived/active_subscriptions_live/view.sql b/sql/moz-fx-data-shared-prod/relay_derived/active_subscriptions_live/view.sql index 2557693550..05a304e380 100644 --- a/sql/moz-fx-data-shared-prod/relay_derived/active_subscriptions_live/view.sql +++ b/sql/moz-fx-data-shared-prod/relay_derived/active_subscriptions_live/view.sql @@ -28,8 +28,7 @@ FROM subscriptions JOIN `moz-fx-data-shared-prod`.relay.active_subscription_ids -USING - (subscription_id) + USING (subscription_id) GROUP BY active_date, plan_id, diff --git a/sql/moz-fx-data-shared-prod/relay_derived/subscription_events_live/view.sql b/sql/moz-fx-data-shared-prod/relay_derived/subscription_events_live/view.sql index ea9be6573b..eb559f76a5 100644 --- a/sql/moz-fx-data-shared-prod/relay_derived/subscription_events_live/view.sql +++ b/sql/moz-fx-data-shared-prod/relay_derived/subscription_events_live/view.sql @@ -121,8 +121,7 @@ FROM subscriptions JOIN events -USING - (subscription_id) + USING (subscription_id) GROUP BY event_date, event_type, diff --git a/sql/moz-fx-data-shared-prod/relay_derived/subscriptions_v1/query.sql b/sql/moz-fx-data-shared-prod/relay_derived/subscriptions_v1/query.sql index 461ce0b421..5f7cfceab3 100644 --- a/sql/moz-fx-data-shared-prod/relay_derived/subscriptions_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/relay_derived/subscriptions_v1/query.sql @@ -99,8 +99,7 @@ relay_subscriptions AS ( stripe_subscriptions_history LEFT JOIN standardized_country - USING - (country) + USING (country) -- LEFT JOIN -- users -- USING diff --git a/sql/moz-fx-data-shared-prod/search_derived/mobile_search_clients_daily_v1/query.sql b/sql/moz-fx-data-shared-prod/search_derived/mobile_search_clients_daily_v1/query.sql index 937afc056b..7045506018 100755 --- a/sql/moz-fx-data-shared-prod/search_derived/mobile_search_clients_daily_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/search_derived/mobile_search_clients_daily_v1/query.sql @@ -641,8 +641,7 @@ fenix_metrics_with_locale AS ( fenix_metrics LEFT JOIN fenix_client_locales - USING - (client_id) + USING (client_id) ), glean_metrics AS ( SELECT diff --git a/sql/moz-fx-data-shared-prod/search_derived/mobile_search_clients_last_seen_v1/query.sql b/sql/moz-fx-data-shared-prod/search_derived/mobile_search_clients_last_seen_v1/query.sql index 8de264346c..7a5f221884 100644 --- a/sql/moz-fx-data-shared-prod/search_derived/mobile_search_clients_last_seen_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/search_derived/mobile_search_clients_last_seen_v1/query.sql @@ -131,5 +131,4 @@ FROM _current FULL OUTER JOIN _previous -USING - (client_id) + USING (client_id) diff --git a/sql/moz-fx-data-shared-prod/search_derived/search_clients_daily_v8/query.sql b/sql/moz-fx-data-shared-prod/search_derived/search_clients_daily_v8/query.sql index 57641992c2..f372cf5bcc 100755 --- a/sql/moz-fx-data-shared-prod/search_derived/search_clients_daily_v8/query.sql +++ b/sql/moz-fx-data-shared-prod/search_derived/search_clients_daily_v8/query.sql @@ -41,8 +41,7 @@ clients_with_adblocker_addons AS ( UNNEST(active_addons) a INNER JOIN adblocker_addons - USING - (addon_id) + USING (addon_id) WHERE submission_date = @submission_date AND NOT a.user_disabled @@ -105,8 +104,7 @@ combined_access_point AS ( telemetry.clients_daily LEFT JOIN clients_with_adblocker_addons - USING - (client_id, submission_date) + USING (client_id, submission_date) ), augmented AS ( SELECT diff --git a/sql/moz-fx-data-shared-prod/search_derived/search_clients_last_seen_v1/query.sql b/sql/moz-fx-data-shared-prod/search_derived/search_clients_last_seen_v1/query.sql index 6caa29da2e..04376bcb58 100755 --- a/sql/moz-fx-data-shared-prod/search_derived/search_clients_last_seen_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/search_derived/search_clients_last_seen_v1/query.sql @@ -144,7 +144,6 @@ FROM _current FULL OUTER JOIN _previous -USING -- Include sample_id to match the clustering of the tables, which may improve -- join performance. - (sample_id, client_id) + USING (sample_id, client_id) diff --git a/sql/moz-fx-data-shared-prod/search_derived/search_revenue_levers_daily_v1/query.sql b/sql/moz-fx-data-shared-prod/search_derived/search_revenue_levers_daily_v1/query.sql index 90f225092b..df63d166b4 100644 --- a/sql/moz-fx-data-shared-prod/search_derived/search_revenue_levers_daily_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/search_derived/search_revenue_levers_daily_v1/query.sql @@ -209,8 +209,7 @@ mobile_data_google AS ( `moz-fx-data-shared-prod.search.mobile_search_clients_engines_sources_daily` INNER JOIN mobile_dau_data dau - USING - (submission_date) + USING (submission_date) WHERE submission_date = @submission_date AND country NOT IN ('RU', 'UA', 'BY', 'TR', 'KZ', 'CN') @@ -288,8 +287,7 @@ mobile_data_bing_ddg AS ( `moz-fx-data-shared-prod.search.mobile_search_clients_engines_sources_daily` INNER JOIN mobile_dau_data dau - USING - (submission_date) + USING (submission_date) WHERE submission_date = @submission_date AND ( diff --git a/sql/moz-fx-data-shared-prod/search_terms/sanitization_job_data_validation_metrics/view.sql b/sql/moz-fx-data-shared-prod/search_terms/sanitization_job_data_validation_metrics/view.sql index 29afb2c581..9e21c53c8a 100644 --- a/sql/moz-fx-data-shared-prod/search_terms/sanitization_job_data_validation_metrics/view.sql +++ b/sql/moz-fx-data-shared-prod/search_terms/sanitization_job_data_validation_metrics/view.sql @@ -36,8 +36,7 @@ JOIN GROUP BY job_start_time ) AS languages -ON - metadata.started_at = languages.job_start_time + ON metadata.started_at = languages.job_start_time WHERE status = 'SUCCESS' ORDER BY diff --git a/sql/moz-fx-data-shared-prod/search_terms_derived/aggregated_search_terms_daily_v1/query.sql b/sql/moz-fx-data-shared-prod/search_terms_derived/aggregated_search_terms_daily_v1/query.sql index 598bb09172..2682ebd079 100644 --- a/sql/moz-fx-data-shared-prod/search_terms_derived/aggregated_search_terms_daily_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/search_terms_derived/aggregated_search_terms_daily_v1/query.sql @@ -30,5 +30,4 @@ FROM aggregated_search_terms LEFT JOIN suggest_attributes -USING - (search_terms) + USING (search_terms) diff --git a/sql/moz-fx-data-shared-prod/search_terms_derived/suggest_impression_sanitized_v2/query.sql b/sql/moz-fx-data-shared-prod/search_terms_derived/suggest_impression_sanitized_v2/query.sql index a46ea8a7c1..f8fd66afd2 100644 --- a/sql/moz-fx-data-shared-prod/search_terms_derived/suggest_impression_sanitized_v2/query.sql +++ b/sql/moz-fx-data-shared-prod/search_terms_derived/suggest_impression_sanitized_v2/query.sql @@ -33,8 +33,7 @@ validated_impressions AS ( sanitized_impressions_count LEFT JOIN sanitized_impressions - ON - TRUE + ON TRUE WHERE IF( _n < 1, diff --git a/sql/moz-fx-data-shared-prod/search_terms_derived/suggest_impression_sanitized_v2_external/query.sql b/sql/moz-fx-data-shared-prod/search_terms_derived/suggest_impression_sanitized_v2_external/query.sql index e0e2a3103b..074b9fc0ff 100644 --- a/sql/moz-fx-data-shared-prod/search_terms_derived/suggest_impression_sanitized_v2_external/query.sql +++ b/sql/moz-fx-data-shared-prod/search_terms_derived/suggest_impression_sanitized_v2_external/query.sql @@ -80,8 +80,7 @@ merino_sanitized AS ( merino_logs LEFT JOIN allowed_queries - USING - (query) + USING (query) ) SELECT * EXCEPT (request_id, sanitized_query, telemetry_query), @@ -90,5 +89,4 @@ FROM impressions LEFT JOIN merino_sanitized -USING - (request_id) + USING (request_id) diff --git a/sql/moz-fx-data-shared-prod/search_terms_derived/suggest_impression_sanitized_v3/query.sql b/sql/moz-fx-data-shared-prod/search_terms_derived/suggest_impression_sanitized_v3/query.sql index 38fb4c0d02..196562f4d2 100644 --- a/sql/moz-fx-data-shared-prod/search_terms_derived/suggest_impression_sanitized_v3/query.sql +++ b/sql/moz-fx-data-shared-prod/search_terms_derived/suggest_impression_sanitized_v3/query.sql @@ -63,8 +63,7 @@ validated_queries AS ( sanitized_queries_count LEFT JOIN sanitized_queries - ON - TRUE + ON TRUE WHERE IF( _n < 1, @@ -80,5 +79,4 @@ FROM impressions LEFT JOIN validated_queries -USING - (request_id) + USING (request_id) diff --git a/sql/moz-fx-data-shared-prod/static/fxa_amplitude_export_users_last_seen/query.sql b/sql/moz-fx-data-shared-prod/static/fxa_amplitude_export_users_last_seen/query.sql index 0d77838395..594a634665 100755 --- a/sql/moz-fx-data-shared-prod/static/fxa_amplitude_export_users_last_seen/query.sql +++ b/sql/moz-fx-data-shared-prod/static/fxa_amplitude_export_users_last_seen/query.sql @@ -46,5 +46,4 @@ FROM current_sample FULL JOIN previous -USING - (user_id) + USING (user_id) diff --git a/sql/moz-fx-data-shared-prod/stripe/itemized_payout_reconciliation/view.sql b/sql/moz-fx-data-shared-prod/stripe/itemized_payout_reconciliation/view.sql index bcab786999..50879a9f85 100644 --- a/sql/moz-fx-data-shared-prod/stripe/itemized_payout_reconciliation/view.sql +++ b/sql/moz-fx-data-shared-prod/stripe/itemized_payout_reconciliation/view.sql @@ -36,12 +36,10 @@ charge_states AS ( `moz-fx-data-shared-prod`.stripe_external.charge_v1 AS charges JOIN `moz-fx-data-shared-prod`.stripe_external.card_v1 AS cards - ON - charges.card_id = cards.id + ON charges.card_id = cards.id JOIN postal_code_to_state - ON - cards.country = postal_code_to_state.country + ON cards.country = postal_code_to_state.country AND UPPER(TRIM(charges.billing_detail_address_postal_code)) = postal_code_to_state.postal_code WHERE cards.country IN ("US", "CA") @@ -118,13 +116,10 @@ FROM `moz-fx-data-shared-prod`.stripe_external.itemized_payout_reconciliation_v5 AS report LEFT JOIN charge_states -USING - (charge_id, card_country) + USING (charge_id, card_country) LEFT JOIN subscriptions -USING - (subscription_id) + USING (subscription_id) LEFT JOIN taxes -USING - (invoice_id) + USING (invoice_id) diff --git a/sql/moz-fx-data-shared-prod/stripe_external/customers_changelog_v1/query.sql b/sql/moz-fx-data-shared-prod/stripe_external/customers_changelog_v1/query.sql index c7d15b40a2..92313cb594 100644 --- a/sql/moz-fx-data-shared-prod/stripe_external/customers_changelog_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/stripe_external/customers_changelog_v1/query.sql @@ -62,14 +62,12 @@ customer_latest_discounts AS ( customers JOIN `moz-fx-data-shared-prod`.stripe_external.customer_discount_v1 AS customer_discounts - ON - customers.id = customer_discounts.customer_id + ON customers.id = customer_discounts.customer_id AND customers._fivetran_synced >= customer_discounts.start AND (customers._fivetran_synced < customer_discounts.`end` OR customer_discounts.`end` IS NULL) JOIN `moz-fx-data-shared-prod`.stripe_external.coupon_v1 AS coupons - ON - customer_discounts.coupon_id = coupons.id + ON customer_discounts.coupon_id = coupons.id GROUP BY customers.id ) @@ -101,5 +99,4 @@ FROM customers LEFT JOIN customer_latest_discounts -ON - customers.id = customer_latest_discounts.customer_id + ON customers.id = customer_latest_discounts.customer_id diff --git a/sql/moz-fx-data-shared-prod/stripe_external/subscriptions_changelog_v1/query.sql b/sql/moz-fx-data-shared-prod/stripe_external/subscriptions_changelog_v1/query.sql index 8032ee5add..af8f24705c 100644 --- a/sql/moz-fx-data-shared-prod/stripe_external/subscriptions_changelog_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/stripe_external/subscriptions_changelog_v1/query.sql @@ -112,8 +112,7 @@ subscriptions_history_with_end_plan_ids AS ( subscriptions_history_with_plan_metadata AS subscriptions_history JOIN subscription_items - ON - subscriptions_history.subscription_id = subscription_items.subscription_id + ON subscriptions_history.subscription_id = subscription_items.subscription_id ), subscriptions_history_with_plan_ids AS ( -- Fill in `plan_id` by getting the next `end_plan_id`. @@ -152,12 +151,10 @@ subscriptions_history_tax_rates AS ( subscriptions_history JOIN `moz-fx-data-shared-prod`.stripe_external.subscription_tax_rate_v1 AS subscription_tax_rates - ON - subscriptions_history.subscription_id = subscription_tax_rates.subscription_id + ON subscriptions_history.subscription_id = subscription_tax_rates.subscription_id JOIN `moz-fx-data-shared-prod`.stripe_external.tax_rate_v1 AS tax_rates - ON - subscription_tax_rates.tax_rate_id = tax_rates.id + ON subscription_tax_rates.tax_rate_id = tax_rates.id AND subscriptions_history._fivetran_start >= tax_rates.created GROUP BY subscriptions_history.id @@ -195,13 +192,11 @@ subscriptions_history_latest_discounts AS ( subscriptions_history JOIN `moz-fx-data-shared-prod`.stripe_external.subscription_discount_v1 AS subscription_discounts - ON - subscriptions_history.subscription_id = subscription_discounts.subscription_id + ON subscriptions_history.subscription_id = subscription_discounts.subscription_id AND subscriptions_history._fivetran_start >= subscription_discounts.start JOIN `moz-fx-data-shared-prod`.stripe_external.coupon_v1 AS coupons - ON - subscription_discounts.coupon_id = coupons.id + ON subscription_discounts.coupon_id = coupons.id GROUP BY subscriptions_history.id ) @@ -272,24 +267,19 @@ FROM subscriptions_history_with_plan_ids AS subscriptions_history JOIN subscription_items -ON - subscriptions_history.subscription_id = subscription_items.subscription_id + ON subscriptions_history.subscription_id = subscription_items.subscription_id LEFT JOIN plans -ON - subscriptions_history.plan_id = plans.id + ON subscriptions_history.plan_id = plans.id LEFT JOIN products -ON - plans.product_id = products.id + ON plans.product_id = products.id LEFT JOIN subscriptions_history_tax_rates -ON - subscriptions_history.id = subscriptions_history_tax_rates.subscription_history_id + ON subscriptions_history.id = subscriptions_history_tax_rates.subscription_history_id LEFT JOIN subscriptions_history_latest_discounts -ON - subscriptions_history.id = subscriptions_history_latest_discounts.subscription_history_id + ON subscriptions_history.id = subscriptions_history_latest_discounts.subscription_history_id WHERE {% if is_init() %} DATE(subscriptions_history._fivetran_start) < CURRENT_DATE() diff --git a/sql/moz-fx-data-shared-prod/stub_attribution_service_derived/dl_token_ga_attribution_lookup_v1/query.sql b/sql/moz-fx-data-shared-prod/stub_attribution_service_derived/dl_token_ga_attribution_lookup_v1/query.sql index 217dbb275e..33f281c5b7 100644 --- a/sql/moz-fx-data-shared-prod/stub_attribution_service_derived/dl_token_ga_attribution_lookup_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/stub_attribution_service_derived/dl_token_ga_attribution_lookup_v1/query.sql @@ -33,5 +33,4 @@ FROM historical_triplets AS _previous FULL OUTER JOIN new_downloads AS _current -USING - (dl_token, ga_client_id, stub_session_id) + USING (dl_token, ga_client_id, stub_session_id) diff --git a/sql/moz-fx-data-shared-prod/subscription_platform_derived/apple_subscriptions_v1/query.sql b/sql/moz-fx-data-shared-prod/subscription_platform_derived/apple_subscriptions_v1/query.sql index f8aec6e6de..29d8bc51fe 100644 --- a/sql/moz-fx-data-shared-prod/subscription_platform_derived/apple_subscriptions_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/subscription_platform_derived/apple_subscriptions_v1/query.sql @@ -103,8 +103,7 @@ apple_iap_period_aggregates AS ( apple_iap_periods AS periods JOIN apple_iap_events AS events - ON - periods.original_transaction_id = events.original_transaction_id + ON periods.original_transaction_id = events.original_transaction_id AND periods.user_id = events.user_id AND periods.start_time <= events.purchase_date AND periods.end_time > events.purchase_date @@ -154,8 +153,7 @@ apple_iap_trial_periods AS ( apple_iap_trial_events AS trial_events JOIN apple_iap_periods AS periods - ON - trial_events.original_transaction_id = periods.original_transaction_id + ON trial_events.original_transaction_id = periods.original_transaction_id AND trial_events.user_id = periods.user_id AND trial_events.purchase_date >= periods.start_time AND trial_events.purchase_date < periods.end_time @@ -237,5 +235,4 @@ FROM apple_iap_enhanced_period_aggregates AS periods LEFT JOIN apple_iap_trial_periods AS trial_periods -USING - (original_transaction_id, user_id, period_offset) + USING (original_transaction_id, user_id, period_offset) diff --git a/sql/moz-fx-data-shared-prod/subscription_platform_derived/daily_active_logical_subscriptions_v1/query.sql b/sql/moz-fx-data-shared-prod/subscription_platform_derived/daily_active_logical_subscriptions_v1/query.sql index 5c5d94caf2..3f0e16a9fa 100644 --- a/sql/moz-fx-data-shared-prod/subscription_platform_derived/daily_active_logical_subscriptions_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/subscription_platform_derived/daily_active_logical_subscriptions_v1/query.sql @@ -34,8 +34,7 @@ daily_active_subscriptions_history AS ( dates JOIN `moz-fx-data-shared-prod.subscription_platform_derived.logical_subscriptions_history_v1` AS subscriptions_history - ON - TIMESTAMP(dates.next_date) > subscriptions_history.valid_from + ON TIMESTAMP(dates.next_date) > subscriptions_history.valid_from AND TIMESTAMP(dates.date) < subscriptions_history.valid_to AND ( TIMESTAMP(dates.date) < subscriptions_history.subscription.ended_at diff --git a/sql/moz-fx-data-shared-prod/subscription_platform_derived/google_subscriptions_v1/query.sql b/sql/moz-fx-data-shared-prod/subscription_platform_derived/google_subscriptions_v1/query.sql index 6c4a6e0ef0..948ffc6391 100644 --- a/sql/moz-fx-data-shared-prod/subscription_platform_derived/google_subscriptions_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/subscription_platform_derived/google_subscriptions_v1/query.sql @@ -152,5 +152,4 @@ FROM google_iap_periods AS periods LEFT JOIN google_iap_trial_periods AS trial_periods -USING - (document_id, start_time) + USING (document_id, start_time) diff --git a/sql/moz-fx-data-shared-prod/subscription_platform_derived/logical_subscriptions_history_v1/query.sql b/sql/moz-fx-data-shared-prod/subscription_platform_derived/logical_subscriptions_history_v1/query.sql index 9a2e6b103b..ecf0b91d52 100644 --- a/sql/moz-fx-data-shared-prod/subscription_platform_derived/logical_subscriptions_history_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/subscription_platform_derived/logical_subscriptions_history_v1/query.sql @@ -46,8 +46,7 @@ customer_attribution_impressions AS ( `moz-fx-data-shared-prod.mozilla_vpn_derived.users_attribution_v1` AS users_attribution JOIN `moz-fx-data-shared-prod.mozilla_vpn_derived.users_v1` AS users - ON - users_attribution.user_id = users.id + ON users_attribution.user_id = users.id WHERE DATE(users.created_at) <= '2021-08-25' AND ( @@ -110,8 +109,7 @@ subscription_attributions AS ( UNNEST(subscription_starts.services) AS service JOIN customer_attribution_impressions - ON - subscription_starts.mozilla_account_id_sha256 = customer_attribution_impressions.mozilla_account_id_sha256 + ON subscription_starts.mozilla_account_id_sha256 = customer_attribution_impressions.mozilla_account_id_sha256 AND service.id IN UNNEST(customer_attribution_impressions.service_ids) AND subscription_starts.started_at >= customer_attribution_impressions.impression_at GROUP BY @@ -205,9 +203,7 @@ FROM history LEFT JOIN countries -ON - history.subscription.country_code = countries.code + ON history.subscription.country_code = countries.code LEFT JOIN subscription_attributions -ON - history.subscription.id = subscription_attributions.subscription_id + ON history.subscription.id = subscription_attributions.subscription_id diff --git a/sql/moz-fx-data-shared-prod/subscription_platform_derived/monthly_active_logical_subscriptions_v1/query.sql b/sql/moz-fx-data-shared-prod/subscription_platform_derived/monthly_active_logical_subscriptions_v1/query.sql index a9eca7879d..f310620ec9 100644 --- a/sql/moz-fx-data-shared-prod/subscription_platform_derived/monthly_active_logical_subscriptions_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/subscription_platform_derived/monthly_active_logical_subscriptions_v1/query.sql @@ -37,8 +37,7 @@ monthly_active_subscriptions AS ( months JOIN `moz-fx-data-shared-prod.subscription_platform_derived.daily_active_logical_subscriptions_v1` AS daily_subscriptions - ON - (daily_subscriptions.date BETWEEN months.month_start_date AND months.month_end_date) + ON (daily_subscriptions.date BETWEEN months.month_start_date AND months.month_end_date) GROUP BY months.month_start_date, months.month_end_date, diff --git a/sql/moz-fx-data-shared-prod/subscription_platform_derived/nonprod_apple_subscriptions_v1/query.sql b/sql/moz-fx-data-shared-prod/subscription_platform_derived/nonprod_apple_subscriptions_v1/query.sql index 80dba8203c..5874f6cb76 100644 --- a/sql/moz-fx-data-shared-prod/subscription_platform_derived/nonprod_apple_subscriptions_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/subscription_platform_derived/nonprod_apple_subscriptions_v1/query.sql @@ -102,8 +102,7 @@ apple_iap_period_aggregates AS ( apple_iap_periods AS periods JOIN apple_iap_events AS events - ON - periods.original_transaction_id = events.original_transaction_id + ON periods.original_transaction_id = events.original_transaction_id AND periods.user_id = events.user_id AND periods.start_time <= events.purchase_date AND periods.end_time > events.purchase_date @@ -211,5 +210,4 @@ FROM apple_iap_enhanced_period_aggregates AS periods LEFT JOIN apple_iap_trial_periods AS trial_periods -USING - (original_transaction_id, user_id) + USING (original_transaction_id, user_id) diff --git a/sql/moz-fx-data-shared-prod/subscription_platform_derived/nonprod_google_subscriptions_v1/query.sql b/sql/moz-fx-data-shared-prod/subscription_platform_derived/nonprod_google_subscriptions_v1/query.sql index 01a12a4a8c..4360db5a03 100644 --- a/sql/moz-fx-data-shared-prod/subscription_platform_derived/nonprod_google_subscriptions_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/subscription_platform_derived/nonprod_google_subscriptions_v1/query.sql @@ -152,5 +152,4 @@ FROM google_iap_periods AS periods LEFT JOIN google_iap_trial_periods AS trial_periods -USING - (document_id, start_time) + USING (document_id, start_time) diff --git a/sql/moz-fx-data-shared-prod/subscription_platform_derived/nonprod_stripe_subscriptions_history_v1/query.sql b/sql/moz-fx-data-shared-prod/subscription_platform_derived/nonprod_stripe_subscriptions_history_v1/query.sql index f200655b97..d54832d0bd 100644 --- a/sql/moz-fx-data-shared-prod/subscription_platform_derived/nonprod_stripe_subscriptions_history_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/subscription_platform_derived/nonprod_stripe_subscriptions_history_v1/query.sql @@ -135,8 +135,7 @@ subscriptions_history_with_plan_ids AS ( subscriptions_history_with_previous_plan_ids AS subscriptions_history JOIN subscription_items - USING - (subscription_id) + USING (subscription_id) ), product_capabilities AS ( SELECT @@ -146,8 +145,7 @@ product_capabilities AS ( `moz-fx-data-shared-prod`.stripe_external.nonprod_product_v1 AS products JOIN UNNEST(mozfun.json.js_extract_string_map(metadata)) AS metadata_items - ON - metadata_items.key LIKE 'capabilities%' + ON metadata_items.key LIKE 'capabilities%' JOIN UNNEST(SPLIT(metadata_items.value, ",")) AS capability WHERE @@ -163,8 +161,7 @@ plan_capabilities AS ( `moz-fx-data-shared-prod`.stripe_external.nonprod_plan_v1 AS plans JOIN UNNEST(mozfun.json.js_extract_string_map(metadata)) AS metadata_items - ON - metadata_items.key LIKE 'capabilities%' + ON metadata_items.key LIKE 'capabilities%' JOIN UNNEST(SPLIT(metadata_items.value, ",")) AS capability WHERE @@ -189,16 +186,13 @@ plans AS ( `moz-fx-data-shared-prod`.stripe_external.nonprod_plan_v1 AS plans LEFT JOIN `moz-fx-data-shared-prod`.stripe_external.nonprod_product_v1 AS products - ON - plans.product_id = products.id + ON plans.product_id = products.id LEFT JOIN plan_capabilities - ON - plans.id = plan_capabilities.plan_id + ON plans.id = plan_capabilities.plan_id LEFT JOIN product_capabilities - USING - (product_id) + USING (product_id) ), customers AS ( SELECT @@ -216,8 +210,7 @@ charges AS ( `moz-fx-data-shared-prod`.stripe_external.nonprod_charge_v1 AS charges JOIN `moz-fx-data-shared-prod`.stripe_external.nonprod_card_v1 AS cards - ON - charges.card_id = cards.id + ON charges.card_id = cards.id WHERE charges.status = "succeeded" ), @@ -235,12 +228,10 @@ invoices_provider_country AS ( `moz-fx-data-shared-prod`.stripe_external.nonprod_invoice_v1 AS invoices LEFT JOIN customers - USING - (customer_id) + USING (customer_id) LEFT JOIN charges - USING - (charge_id) + USING (charge_id) WHERE invoices.status = "paid" ), @@ -264,8 +255,7 @@ subscriptions_history_provider_country AS ( subscriptions_history JOIN invoices_provider_country - ON - subscriptions_history.subscription_id = invoices_provider_country.subscription_id + ON subscriptions_history.subscription_id = invoices_provider_country.subscription_id AND ( invoices_provider_country.created < subscriptions_history.valid_to OR subscriptions_history.valid_to IS NULL @@ -289,24 +279,20 @@ subscriptions_history_promotions AS ( subscriptions_history JOIN `moz-fx-data-shared-prod`.stripe_external.nonprod_invoice_v1 AS invoices - ON - subscriptions_history.subscription_id = invoices.subscription_id + ON subscriptions_history.subscription_id = invoices.subscription_id AND ( invoices.created < subscriptions_history.valid_to OR subscriptions_history.valid_to IS NULL ) JOIN `moz-fx-data-shared-prod`.stripe_external.nonprod_invoice_discount_v1 AS invoice_discounts - ON - invoices.id = invoice_discounts.invoice_id + ON invoices.id = invoice_discounts.invoice_id JOIN `moz-fx-data-shared-prod`.stripe_external.nonprod_promotion_code_v1 AS promotion_codes - ON - invoice_discounts.promotion_code = promotion_codes.id + ON invoice_discounts.promotion_code = promotion_codes.id JOIN `moz-fx-data-shared-prod`.stripe_external.nonprod_coupon_v1 AS coupons - ON - promotion_codes.coupon_id = coupons.id + ON promotion_codes.coupon_id = coupons.id WHERE invoices.status = "paid" GROUP BY @@ -353,17 +339,13 @@ FROM subscriptions_history_with_plan_ids AS subscriptions_history LEFT JOIN plans -USING - (plan_id) + USING (plan_id) LEFT JOIN customers -USING - (customer_id) + USING (customer_id) LEFT JOIN subscriptions_history_provider_country -USING - (subscription_id, valid_from) + USING (subscription_id, valid_from) LEFT JOIN subscriptions_history_promotions -USING - (subscription_id, valid_from) + USING (subscription_id, valid_from) diff --git a/sql/moz-fx-data-shared-prod/subscription_platform_derived/services_v1/query.sql b/sql/moz-fx-data-shared-prod/subscription_platform_derived/services_v1/query.sql index ae69475568..a73d40e8cf 100644 --- a/sql/moz-fx-data-shared-prod/subscription_platform_derived/services_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/subscription_platform_derived/services_v1/query.sql @@ -99,8 +99,7 @@ service_stripe_product_ids AS ( UNNEST( SPLIT(JSON_VALUE(stripe_products.metadata['capabilities:' || subplat_oauth_client.id]), ',') ) AS capability - ON - TRIM(capability) IN UNNEST(services.subplat_capabilities) + ON TRIM(capability) IN UNNEST(services.subplat_capabilities) GROUP BY service_id ), @@ -117,8 +116,7 @@ service_stripe_plan_capabilities AS ( stripe_plans LEFT JOIN stripe_products - ON - stripe_plans.product_id = stripe_products.id + ON stripe_plans.product_id = stripe_products.id JOIN UNNEST( SPLIT( @@ -129,8 +127,7 @@ service_stripe_plan_capabilities AS ( ',' ) ) AS capability - ON - TRIM(capability) IN UNNEST(services.subplat_capabilities) + ON TRIM(capability) IN UNNEST(services.subplat_capabilities) ), service_stripe_plan_ids AS ( SELECT @@ -151,13 +148,11 @@ service_stripe_plan_tier_names AS ( service_stripe_plan_capabilities JOIN services - ON - service_stripe_plan_capabilities.service_id = services.id + ON service_stripe_plan_capabilities.service_id = services.id JOIN UNNEST(services.tiers) AS tier WITH OFFSET AS tier_order - ON - service_stripe_plan_capabilities.capability IN UNNEST(tier.subplat_capabilities) + ON service_stripe_plan_capabilities.capability IN UNNEST(tier.subplat_capabilities) GROUP BY service_id, stripe_plan_id @@ -188,8 +183,7 @@ service_tiers AS ( WITH OFFSET AS tier_order LEFT JOIN service_tier_stripe_plan_ids - ON - services.id = service_tier_stripe_plan_ids.service_id + ON services.id = service_tier_stripe_plan_ids.service_id AND tier.name = service_tier_stripe_plan_ids.tier_name GROUP BY service_id @@ -202,13 +196,10 @@ FROM services LEFT JOIN service_tiers -ON - services.id = service_tiers.service_id + ON services.id = service_tiers.service_id LEFT JOIN service_stripe_product_ids -ON - services.id = service_stripe_product_ids.service_id + ON services.id = service_stripe_product_ids.service_id LEFT JOIN service_stripe_plan_ids -ON - services.id = service_stripe_plan_ids.service_id + ON services.id = service_stripe_plan_ids.service_id diff --git a/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_customers_revised_changelog_v1/query.sql b/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_customers_revised_changelog_v1/query.sql index 57f14bcc77..e7463a6c05 100644 --- a/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_customers_revised_changelog_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_customers_revised_changelog_v1/query.sql @@ -140,8 +140,7 @@ augmented_original_changelog AS ( original_changelog AS changelog LEFT JOIN customer_subscription_dates - ON - changelog.customer.id = customer_subscription_dates.customer_id + ON changelog.customer.id = customer_subscription_dates.customer_id UNION ALL SELECT 'pre_fivetran' AS type, @@ -242,8 +241,7 @@ synthetic_customer_deletion_changelog AS ( questionable_initial_changelog AS changelog LEFT JOIN customer_subscription_dates - ON - changelog.customer.id = customer_subscription_dates.customer_id + ON changelog.customer.id = customer_subscription_dates.customer_id WHERE changelog.customer.is_deleted AND customer_subscription_dates.last_subscription_ended_at IS NOT NULL diff --git a/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_logical_subscriptions_history_v1/query.sql b/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_logical_subscriptions_history_v1/query.sql index f801428110..cb251f5c9e 100644 --- a/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_logical_subscriptions_history_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_logical_subscriptions_history_v1/query.sql @@ -46,8 +46,7 @@ plan_services AS ( UNNEST(services.stripe_plan_ids) AS plan_id LEFT JOIN UNNEST(services.tiers) AS tier - ON - plan_id IN UNNEST(tier.stripe_plan_ids) + ON plan_id IN UNNEST(tier.stripe_plan_ids) GROUP BY plan_id ), @@ -84,21 +83,17 @@ subscriptions_history_charge_summaries AS ( `moz-fx-data-shared-prod.stripe_external.charge_v1` AS charges JOIN `moz-fx-data-shared-prod.stripe_external.invoice_v1` AS invoices - ON - charges.invoice_id = invoices.id + ON charges.invoice_id = invoices.id JOIN active_subscriptions_history AS history - ON - invoices.subscription_id = history.subscription.id + ON invoices.subscription_id = history.subscription.id AND charges.created < history.valid_to LEFT JOIN `moz-fx-data-shared-prod.stripe_external.card_v1` AS cards - ON - charges.card_id = cards.id + ON charges.card_id = cards.id LEFT JOIN `moz-fx-data-shared-prod.stripe_external.refund_v1` AS refunds - ON - charges.id = refunds.charge_id + ON charges.id = refunds.charge_id GROUP BY subscriptions_history_id ) @@ -198,13 +193,10 @@ CROSS JOIN UNNEST(history.subscription.items) AS subscription_item LEFT JOIN plan_services -ON - subscription_item.plan.id = plan_services.plan_id + ON subscription_item.plan.id = plan_services.plan_id LEFT JOIN paypal_subscriptions -ON - history.subscription.id = paypal_subscriptions.subscription_id + ON history.subscription.id = paypal_subscriptions.subscription_id LEFT JOIN subscriptions_history_charge_summaries AS charge_summaries -ON - history.id = charge_summaries.subscriptions_history_id + ON history.id = charge_summaries.subscriptions_history_id diff --git a/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_subscriptions_history_v1/query.sql b/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_subscriptions_history_v1/query.sql index 7be3b7ea1f..d68524a94f 100644 --- a/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_subscriptions_history_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_subscriptions_history_v1/query.sql @@ -135,8 +135,7 @@ subscriptions_history_with_plan_ids AS ( subscriptions_history_with_previous_plan_ids AS subscriptions_history JOIN subscription_items - USING - (subscription_id) + USING (subscription_id) ), product_capabilities AS ( SELECT @@ -146,8 +145,7 @@ product_capabilities AS ( `moz-fx-data-shared-prod`.stripe_external.product_v1 AS products JOIN UNNEST(mozfun.json.js_extract_string_map(metadata)) AS metadata_items - ON - metadata_items.key LIKE 'capabilities%' + ON metadata_items.key LIKE 'capabilities%' JOIN UNNEST(SPLIT(metadata_items.value, ",")) AS capability WHERE @@ -163,8 +161,7 @@ plan_capabilities AS ( `moz-fx-data-shared-prod`.stripe_external.plan_v1 AS plans JOIN UNNEST(mozfun.json.js_extract_string_map(metadata)) AS metadata_items - ON - metadata_items.key LIKE 'capabilities%' + ON metadata_items.key LIKE 'capabilities%' JOIN UNNEST(SPLIT(metadata_items.value, ",")) AS capability WHERE @@ -189,16 +186,13 @@ plans AS ( `moz-fx-data-shared-prod`.stripe_external.plan_v1 AS plans LEFT JOIN `moz-fx-data-shared-prod`.stripe_external.product_v1 AS products - ON - plans.product_id = products.id + ON plans.product_id = products.id LEFT JOIN plan_capabilities - ON - plans.id = plan_capabilities.plan_id + ON plans.id = plan_capabilities.plan_id LEFT JOIN product_capabilities - USING - (product_id) + USING (product_id) ), customers AS ( SELECT @@ -226,20 +220,17 @@ customers AS ( FULL JOIN -- Include customers that were deleted before the initial Fivetran Stripe import. `moz-fx-data-shared-prod`.stripe_external.pre_fivetran_customers_v1 AS pre_fivetran_customers - USING - (id) + USING (id) LEFT JOIN `moz-fx-data-shared-prod.static.us_zip_code_prefixes_v1` AS us_shipping_zip_code_prefixes - ON - customers.shipping_address_country = "US" + ON customers.shipping_address_country = "US" AND LEFT( customers.shipping_address_postal_code, 3 ) = us_shipping_zip_code_prefixes.zip_code_prefix LEFT JOIN `moz-fx-data-shared-prod.static.ca_postal_districts_v1` AS ca_shipping_postal_districts - ON - customers.shipping_address_country = "CA" + ON customers.shipping_address_country = "CA" AND UPPER( LEFT(customers.shipping_address_postal_code, 1) ) = ca_shipping_postal_districts.postal_district_code @@ -257,17 +248,14 @@ charges AS ( `moz-fx-data-shared-prod`.stripe_external.charge_v1 AS charges JOIN `moz-fx-data-shared-prod`.stripe_external.card_v1 AS cards - ON - charges.card_id = cards.id + ON charges.card_id = cards.id LEFT JOIN `moz-fx-data-shared-prod.static.us_zip_code_prefixes_v1` AS us_zip_code_prefixes - ON - COALESCE(NULLIF(charges.billing_detail_address_country, ""), cards.country) = "US" + ON COALESCE(NULLIF(charges.billing_detail_address_country, ""), cards.country) = "US" AND LEFT(charges.billing_detail_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_postal_districts - ON - COALESCE(NULLIF(charges.billing_detail_address_country, ""), cards.country) = "CA" + ON COALESCE(NULLIF(charges.billing_detail_address_country, ""), cards.country) = "CA" AND UPPER( LEFT(charges.billing_detail_address_postal_code, 1) ) = ca_postal_districts.postal_district_code @@ -292,12 +280,10 @@ invoices_provider_location AS ( `moz-fx-data-shared-prod`.stripe_external.invoice_v1 AS invoices LEFT JOIN customers - USING - (customer_id) + USING (customer_id) LEFT JOIN charges - USING - (charge_id) + USING (charge_id) WHERE invoices.status = "paid" ), @@ -322,8 +308,7 @@ subscriptions_history_provider_location AS ( subscriptions_history JOIN invoices_provider_location - ON - subscriptions_history.subscription_id = invoices_provider_location.subscription_id + ON subscriptions_history.subscription_id = invoices_provider_location.subscription_id AND ( invoices_provider_location.created < subscriptions_history.valid_to OR subscriptions_history.valid_to IS NULL @@ -363,24 +348,20 @@ subscriptions_history_fraud_refunds AS ( subscriptions_history JOIN `moz-fx-data-shared-prod.stripe_external.invoice_v1` AS invoices - ON - subscriptions_history.subscription_id = invoices.subscription_id + ON subscriptions_history.subscription_id = invoices.subscription_id AND ( invoices.created < subscriptions_history.valid_to OR subscriptions_history.valid_to IS NULL ) LEFT JOIN `moz-fx-data-shared-prod.stripe_external.charge_v1` AS charges - ON - invoices.id = charges.invoice_id + ON invoices.id = charges.invoice_id LEFT JOIN `moz-fx-data-shared-prod.stripe_external.card_v1` AS cards - ON - charges.card_id = cards.id + ON charges.card_id = cards.id LEFT JOIN `moz-fx-data-shared-prod.stripe_external.refund_v1` AS refunds - ON - charges.id = refunds.charge_id + ON charges.id = refunds.charge_id GROUP BY subscription_id, valid_from @@ -400,24 +381,20 @@ subscriptions_history_promotions AS ( subscriptions_history JOIN `moz-fx-data-shared-prod`.stripe_external.invoice_v1 AS invoices - ON - subscriptions_history.subscription_id = invoices.subscription_id + ON subscriptions_history.subscription_id = invoices.subscription_id AND ( invoices.created < subscriptions_history.valid_to OR subscriptions_history.valid_to IS NULL ) JOIN `moz-fx-data-shared-prod`.stripe_external.invoice_discount_v1 AS invoice_discounts - ON - invoices.id = invoice_discounts.invoice_id + ON invoices.id = invoice_discounts.invoice_id JOIN `moz-fx-data-shared-prod`.stripe_external.promotion_code_v1 AS promotion_codes - ON - invoice_discounts.promotion_code = promotion_codes.id + ON invoice_discounts.promotion_code = promotion_codes.id JOIN `moz-fx-data-shared-prod`.stripe_external.coupon_v1 AS coupons - ON - promotion_codes.coupon_id = coupons.id + ON promotion_codes.coupon_id = coupons.id WHERE invoices.status = "paid" GROUP BY @@ -498,21 +475,16 @@ FROM subscriptions_history_with_plan_ids AS subscriptions_history LEFT JOIN plans -USING - (plan_id) + USING (plan_id) LEFT JOIN customers -USING - (customer_id) + USING (customer_id) LEFT JOIN subscriptions_history_provider_location -USING - (subscription_id, valid_from) + USING (subscription_id, valid_from) LEFT JOIN subscriptions_history_fraud_refunds -USING - (subscription_id, valid_from) + USING (subscription_id, valid_from) LEFT JOIN subscriptions_history_promotions -USING - (subscription_id, valid_from) + USING (subscription_id, valid_from) diff --git a/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_subscriptions_history_v2/query.sql b/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_subscriptions_history_v2/query.sql index 8981e56f20..2c73222486 100644 --- a/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_subscriptions_history_v2/query.sql +++ b/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_subscriptions_history_v2/query.sql @@ -29,8 +29,7 @@ subscriptions_customers_history AS ( subscriptions_history LEFT JOIN `moz-fx-data-shared-prod`.subscription_platform_derived.stripe_customers_history_v1 AS customers_history - ON - subscriptions_history.subscription.customer_id = customers_history.customer.id + ON subscriptions_history.subscription.customer_id = customers_history.customer.id AND subscriptions_history.valid_from >= customers_history.valid_from AND subscriptions_history.valid_from < customers_history.valid_to UNION ALL @@ -51,8 +50,7 @@ subscriptions_customers_history AS ( subscriptions_history JOIN `moz-fx-data-shared-prod`.subscription_platform_derived.stripe_customers_history_v1 AS customers_history - ON - subscriptions_history.subscription.customer_id = customers_history.customer.id + ON subscriptions_history.subscription.customer_id = customers_history.customer.id AND subscriptions_history.valid_from < customers_history.valid_from AND subscriptions_history.valid_to > customers_history.valid_from ) diff --git a/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_subscriptions_revised_changelog_v1/query.sql b/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_subscriptions_revised_changelog_v1/query.sql index 9b619a07b0..e67a644350 100644 --- a/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_subscriptions_revised_changelog_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/subscription_platform_derived/stripe_subscriptions_revised_changelog_v1/query.sql @@ -182,8 +182,7 @@ questionable_subscription_plan_changes AS ( questionable_resync_changelog AS changelog JOIN `moz-fx-data-shared-prod`.stripe_external.invoice_line_item_v1 AS invoice_line_items - ON - changelog.subscription.id = invoice_line_items.subscription_id + ON changelog.subscription.id = invoice_line_items.subscription_id AND invoice_line_items.type = 'subscription' AND invoice_line_items.period_start < changelog.subscription.metadata.plan_change_date WHERE @@ -234,12 +233,10 @@ questionable_subscription_plans_history AS ( questionable_subscription_plan_changes AS plan_changes LEFT JOIN `moz-fx-data-shared-prod`.subscription_platform_derived.stripe_plans_v1 AS plans - ON - plan_changes.plan_id = plans.id + ON plan_changes.plan_id = plans.id LEFT JOIN `moz-fx-data-shared-prod`.subscription_platform_derived.stripe_products_v1 AS products - ON - plans.product_id = products.id + ON plans.product_id = products.id WINDOW subscription_plan_changes_asc AS ( PARTITION BY @@ -264,8 +261,7 @@ synthetic_subscription_start_changelog AS ( questionable_resync_changelog AS changelog LEFT JOIN questionable_subscription_plans_history AS plans_history - ON - changelog.subscription.id = plans_history.subscription_id + ON changelog.subscription.id = plans_history.subscription_id AND plans_history.subscription_plan_number = 1 ), synthetic_plan_change_changelog AS ( @@ -284,8 +280,7 @@ synthetic_plan_change_changelog AS ( questionable_subscription_plans_history AS plans_history JOIN questionable_resync_changelog AS changelog - ON - plans_history.subscription_id = changelog.subscription.id + ON plans_history.subscription_id = changelog.subscription.id WHERE plans_history.subscription_plan_number > 1 AND plans_history.valid_from > changelog.subscription.start_date @@ -306,8 +301,7 @@ synthetic_trial_start_changelog AS ( questionable_resync_changelog AS changelog LEFT JOIN questionable_subscription_plans_history AS plans_history - ON - changelog.subscription.id = plans_history.subscription_id + ON changelog.subscription.id = plans_history.subscription_id AND changelog.subscription.trial_start >= plans_history.valid_from AND changelog.subscription.trial_start < plans_history.valid_to WHERE @@ -329,8 +323,7 @@ synthetic_trial_end_changelog AS ( questionable_resync_changelog AS changelog LEFT JOIN questionable_subscription_plans_history AS plans_history - ON - changelog.subscription.id = plans_history.subscription_id + ON changelog.subscription.id = plans_history.subscription_id AND changelog.subscription.trial_end >= plans_history.valid_from AND changelog.subscription.trial_end < plans_history.valid_to WHERE @@ -361,8 +354,7 @@ synthetic_cancel_at_period_end_changelog AS ( questionable_resync_changelog AS changelog LEFT JOIN questionable_subscription_plans_history AS plans_history - ON - changelog.subscription.id = plans_history.subscription_id + ON changelog.subscription.id = plans_history.subscription_id AND changelog.subscription.canceled_at >= plans_history.valid_from AND changelog.subscription.canceled_at < plans_history.valid_to WHERE diff --git a/sql/moz-fx-data-shared-prod/subscription_platform_derived/subplat_attribution_impressions_v1/query.sql b/sql/moz-fx-data-shared-prod/subscription_platform_derived/subplat_attribution_impressions_v1/query.sql index f882e11b8d..9f53646eab 100644 --- a/sql/moz-fx-data-shared-prod/subscription_platform_derived/subplat_attribution_impressions_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/subscription_platform_derived/subplat_attribution_impressions_v1/query.sql @@ -33,8 +33,7 @@ new_service_flow_events AS ( -- If multiple services match this join it can cause fan-outs, but the way we aggregate things this doesn't matter. LEFT JOIN services - ON - events.oauth_client_id IN UNNEST(services.subplat_oauth_client_ids) + ON events.oauth_client_id IN UNNEST(services.subplat_oauth_client_ids) OR events.oauth_client_name IN UNNEST(services.subplat_oauth_client_names) -- For a while Bedrock incorrectly passed VPN's OAuth client name as the OAuth client ID. OR events.oauth_client_id IN UNNEST(services.subplat_oauth_client_names) diff --git a/sql/moz-fx-data-shared-prod/subscription_platform_derived/subplat_flow_events_v1/query.sql b/sql/moz-fx-data-shared-prod/subscription_platform_derived/subplat_flow_events_v1/query.sql index 5ea4638e31..0ebf580c99 100644 --- a/sql/moz-fx-data-shared-prod/subscription_platform_derived/subplat_flow_events_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/subscription_platform_derived/subplat_flow_events_v1/query.sql @@ -69,8 +69,7 @@ CROSS JOIN services_metadata LEFT JOIN existing_flow_ids -ON - new_flow_events.flow_id = existing_flow_ids.flow_id + ON new_flow_events.flow_id = existing_flow_ids.flow_id QUALIFY LOGICAL_OR( new_flow_events.oauth_client_id IN UNNEST(services_metadata.subplat_oauth_client_ids) diff --git a/sql/moz-fx-data-shared-prod/telemetry/firefox_accounts_exact_mau28_by_dimensions_v1/view.sql b/sql/moz-fx-data-shared-prod/telemetry/firefox_accounts_exact_mau28_by_dimensions_v1/view.sql index 13cd00d845..aec91cccd6 100755 --- a/sql/moz-fx-data-shared-prod/telemetry/firefox_accounts_exact_mau28_by_dimensions_v1/view.sql +++ b/sql/moz-fx-data-shared-prod/telemetry/firefox_accounts_exact_mau28_by_dimensions_v1/view.sql @@ -12,5 +12,4 @@ FROM `moz-fx-data-shared-prod.firefox_accounts_derived.exact_mau28_v1` AS raw LEFT JOIN `moz-fx-data-shared-prod.static.country_names_v1` cn -ON - (raw.country = cn.name) + ON (raw.country = cn.name) diff --git a/sql/moz-fx-data-shared-prod/telemetry/firefox_desktop_exact_mau28_v1/view.sql b/sql/moz-fx-data-shared-prod/telemetry/firefox_desktop_exact_mau28_v1/view.sql index f5fbc78fa9..ff71681d8d 100755 --- a/sql/moz-fx-data-shared-prod/telemetry/firefox_desktop_exact_mau28_v1/view.sql +++ b/sql/moz-fx-data-shared-prod/telemetry/firefox_desktop_exact_mau28_v1/view.sql @@ -48,11 +48,9 @@ FROM base FULL JOIN imputed_global -USING - (submission_date) + USING (submission_date) FULL JOIN imputed_tier1 -USING - (submission_date) + USING (submission_date) ORDER BY submission_date diff --git a/sql/moz-fx-data-shared-prod/telemetry/firefox_nondesktop_exact_mau28_by_dimensions_v1/view.sql b/sql/moz-fx-data-shared-prod/telemetry/firefox_nondesktop_exact_mau28_by_dimensions_v1/view.sql index b314af748a..c257b68fb9 100755 --- a/sql/moz-fx-data-shared-prod/telemetry/firefox_nondesktop_exact_mau28_by_dimensions_v1/view.sql +++ b/sql/moz-fx-data-shared-prod/telemetry/firefox_nondesktop_exact_mau28_by_dimensions_v1/view.sql @@ -8,5 +8,4 @@ FROM `moz-fx-data-shared-prod.telemetry_derived.firefox_nondesktop_exact_mau28_v1` AS raw LEFT JOIN `moz-fx-data-shared-prod.static.country_codes_v1` cc -ON - (raw.country = cc.code) + ON (raw.country = cc.code) diff --git a/sql/moz-fx-data-shared-prod/telemetry/mobile_usage_2021/view.sql b/sql/moz-fx-data-shared-prod/telemetry/mobile_usage_2021/view.sql index f40afa4c5e..33422f4f69 100644 --- a/sql/moz-fx-data-shared-prod/telemetry/mobile_usage_2021/view.sql +++ b/sql/moz-fx-data-shared-prod/telemetry/mobile_usage_2021/view.sql @@ -39,5 +39,4 @@ FROM with_pinfo AS usage LEFT JOIN `moz-fx-data-shared-prod.static.country_codes_v1` AS cc -ON - (usage.country = cc.code) + ON (usage.country = cc.code) diff --git a/sql/moz-fx-data-shared-prod/telemetry/releases_latest/view.sql b/sql/moz-fx-data-shared-prod/telemetry/releases_latest/view.sql index e92cf7af3d..d4e84b4f2c 100644 --- a/sql/moz-fx-data-shared-prod/telemetry/releases_latest/view.sql +++ b/sql/moz-fx-data-shared-prod/telemetry/releases_latest/view.sql @@ -54,8 +54,7 @@ joined AS ( dates_and_channels FULL OUTER JOIN releases - USING - (`date`, channel) + USING (`date`, channel) WINDOW latest_values AS ( PARTITION BY diff --git a/sql/moz-fx-data-shared-prod/telemetry/sponsored_tiles_ad_request_fill/view.sql b/sql/moz-fx-data-shared-prod/telemetry/sponsored_tiles_ad_request_fill/view.sql index 50d4a89965..10d618fab2 100644 --- a/sql/moz-fx-data-shared-prod/telemetry/sponsored_tiles_ad_request_fill/view.sql +++ b/sql/moz-fx-data-shared-prod/telemetry/sponsored_tiles_ad_request_fill/view.sql @@ -72,9 +72,7 @@ FROM req LEFT JOIN emp -USING - (submission_date, country, device, form_factor, normalized_os) + USING (submission_date, country, device, form_factor, normalized_os) LEFT JOIN tiles -USING - (submission_date, country, device, form_factor, normalized_os) + USING (submission_date, country, device, form_factor, normalized_os) diff --git a/sql/moz-fx-data-shared-prod/telemetry/windows_10_build_distribution/view.sql b/sql/moz-fx-data-shared-prod/telemetry/windows_10_build_distribution/view.sql index 90000a9353..de0952cc19 100755 --- a/sql/moz-fx-data-shared-prod/telemetry/windows_10_build_distribution/view.sql +++ b/sql/moz-fx-data-shared-prod/telemetry/windows_10_build_distribution/view.sql @@ -31,7 +31,6 @@ FROM channel_summary INNER JOIN counts -USING - (normalized_channel) + USING (normalized_channel) ORDER BY max_build_number ASC diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/active_users_aggregates_attribution_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/active_users_aggregates_attribution_v1/query.sql index cf1f2914d2..0fc534fbd3 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/active_users_aggregates_attribution_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/active_users_aggregates_attribution_v1/query.sql @@ -30,8 +30,7 @@ WITH baseline AS ( `moz-fx-data-shared-prod.telemetry.unified_metrics` AS unified_metrics LEFT JOIN fenix.firefox_android_clients AS att - ON - unified_metrics.client_id = att.client_id + ON unified_metrics.client_id = att.client_id WHERE unified_metrics.submission_date = @submission_date ) diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/active_users_aggregates_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/active_users_aggregates_v1/query.sql index 27cc154a4a..878b956c37 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/active_users_aggregates_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/active_users_aggregates_v1/query.sql @@ -47,8 +47,7 @@ todays_metrics_enriched AS ( todays_metrics LEFT JOIN `mozdata.static.csa_gblmkt_languages` AS languages - ON - todays_metrics.locale = languages.code + ON todays_metrics.locale = languages.code ) SELECT todays_metrics_enriched.* EXCEPT ( diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/addons_daily_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/addons_daily_v1/query.sql index 3cc9cc5c31..24b03af8a2 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/addons_daily_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/addons_daily_v1/query.sql @@ -88,8 +88,7 @@ client_meta AS ( `moz-fx-data-shared-prod.telemetry_derived.clients_last_seen_v1` LEFT JOIN client_searches - USING - (client_id) + USING (client_id) WHERE submission_date = @submission_date ), @@ -225,21 +224,16 @@ FROM (SELECT * EXCEPT (rank) FROM names WHERE rank = 1) JOIN (SELECT * EXCEPT (rank) FROM default_search_engines WHERE rank = 1) -USING - (addon_id) + USING (addon_id) JOIN daut -USING - (addon_id) + USING (addon_id) JOIN waut -USING - (addon_id) + USING (addon_id) JOIN maut -USING - (addon_id) + USING (addon_id) JOIN engagement -USING - (addon_id) + USING (addon_id) diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_histogram_aggregates_content_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_histogram_aggregates_content_v1/query.sql index 10d7ec011d..6158bb956d 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_histogram_aggregates_content_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_histogram_aggregates_content_v1/query.sql @@ -34,8 +34,7 @@ filtered AS ( `moz-fx-data-shared-prod.telemetry_stable.main_v5` INNER JOIN valid_build_ids - ON - (application.build_id = build_id) + ON (application.build_id = build_id) WHERE DATE(submission_timestamp) = @submission_date AND normalized_channel IN ("release", "beta", "nightly") diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_histogram_aggregates_gpu_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_histogram_aggregates_gpu_v1/query.sql index 3b0ed09984..2b68d6177f 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_histogram_aggregates_gpu_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_histogram_aggregates_gpu_v1/query.sql @@ -34,8 +34,7 @@ filtered AS ( `moz-fx-data-shared-prod.telemetry_stable.main_v5` INNER JOIN valid_build_ids - ON - (application.build_id = build_id) + ON (application.build_id = build_id) WHERE DATE(submission_timestamp) = @submission_date AND normalized_channel IN ("release", "beta", "nightly") diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_histogram_aggregates_parent_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_histogram_aggregates_parent_v1/query.sql index 53ca1c6947..475436cfda 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_histogram_aggregates_parent_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_histogram_aggregates_parent_v1/query.sql @@ -34,8 +34,7 @@ filtered AS ( `moz-fx-data-shared-prod.telemetry_stable.main_v5` INNER JOIN valid_build_ids - ON - (application.build_id = build_id) + ON (application.build_id = build_id) WHERE DATE(submission_timestamp) = @submission_date AND normalized_channel IN ("release", "beta", "nightly") diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_joined_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_joined_v1/query.sql index e76d052036..435f36a157 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_joined_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_joined_v1/query.sql @@ -42,15 +42,12 @@ FROM telemetry_derived.clients_daily_v6 AS cd LEFT JOIN daily_events -USING - (submission_date, sample_id, client_id) + USING (submission_date, sample_id, client_id) LEFT JOIN first_seen -USING - (submission_date, sample_id, client_id) + USING (submission_date, sample_id, client_id) LEFT JOIN crashes_daily -USING - (submission_date, sample_id, client_id) + USING (submission_date, sample_id, client_id) WHERE cd.submission_date = @submission_date diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_keyed_boolean_aggregates_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_keyed_boolean_aggregates_v1/query.sql index 6b6cbb82d0..62c6cc91cb 100755 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_keyed_boolean_aggregates_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_keyed_boolean_aggregates_v1/query.sql @@ -18,8 +18,7 @@ filtered AS ( `moz-fx-data-shared-prod.telemetry_stable.main_v5` INNER JOIN valid_build_ids - ON - (application.build_id = build_id) + ON (application.build_id = build_id) WHERE DATE(submission_timestamp) = @submission_date AND normalized_channel IN ("release", "beta", "nightly") diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_keyed_histogram_aggregates_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_keyed_histogram_aggregates_v1/query.sql index c851e18b38..741755ed6f 100755 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_keyed_histogram_aggregates_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_keyed_histogram_aggregates_v1/query.sql @@ -34,8 +34,7 @@ filtered AS ( `moz-fx-data-shared-prod.telemetry_stable.main_v5` INNER JOIN valid_build_ids - ON - (application.build_id = build_id) + ON (application.build_id = build_id) WHERE DATE(submission_timestamp) = @submission_date AND normalized_channel IN ("release", "beta", "nightly") diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_keyed_scalar_aggregates_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_keyed_scalar_aggregates_v1/query.sql index f62a0ba004..31d3cd4f7c 100755 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_keyed_scalar_aggregates_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_keyed_scalar_aggregates_v1/query.sql @@ -18,8 +18,7 @@ filtered AS ( `moz-fx-data-shared-prod.telemetry_stable.main_v5` INNER JOIN valid_build_ids - ON - (application.build_id = build_id) + ON (application.build_id = build_id) WHERE DATE(submission_timestamp) = @submission_date AND normalized_channel IN ("release", "beta", "nightly") diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_scalar_aggregates_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_scalar_aggregates_v1/query.sql index bdb038130d..9c7ec1136d 100755 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_scalar_aggregates_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_scalar_aggregates_v1/query.sql @@ -18,8 +18,7 @@ filtered AS ( `moz-fx-data-shared-prod.telemetry_stable.main_v5` INNER JOIN valid_build_ids - ON - (application.build_id = build_id) + ON (application.build_id = build_id) WHERE DATE(submission_timestamp) = @submission_date AND normalized_channel IN ("release", "beta", "nightly") diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_v6/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_v6/query.sql index 0fb5131fd2..f9e8c01de5 100755 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_v6/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_daily_v6/query.sql @@ -687,8 +687,7 @@ clients_summary AS ( base LEFT JOIN overactive - USING - (client_id) + USING (client_id) WHERE overactive.client_id IS NULL ), diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_first_seen_28_days_later_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_first_seen_28_days_later_v1/query.sql index e911b28027..561363024d 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_first_seen_28_days_later_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_first_seen_28_days_later_v1/query.sql @@ -33,8 +33,7 @@ clients_first_seen_28_days_ago_with_days_seen AS ( clients_first_seen_28_days_ago LEFT JOIN telemetry.clients_last_seen cls - ON - clients_first_seen_28_days_ago.client_id = cls.client_id + ON clients_first_seen_28_days_ago.client_id = cls.client_id AND cls.submission_date = @submission_date ) SELECT diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_first_seen_v1/init.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_first_seen_v1/init.sql index dc77c201d0..6b44a5aa4b 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_first_seen_v1/init.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_first_seen_v1/init.sql @@ -62,8 +62,7 @@ LOOP telemetry_derived.clients_daily_v6 AS cd LEFT JOIN clients_first_seen_dates AS cfsd - ON - (cd.submission_date = cfsd.first_seen_date AND cd.client_id = cfsd.client_id) + ON (cd.submission_date = cfsd.first_seen_date AND cd.client_id = cfsd.client_id) WHERE cfsd.client_id IS NOT NULL AND cd.submission_date >= DATE('2010-01-01') diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_first_seen_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_first_seen_v1/query.sql index f014ab719b..409d2a3abc 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_first_seen_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_first_seen_v1/query.sql @@ -41,5 +41,4 @@ FROM previous FULL JOIN today -USING - (client_id) + USING (client_id) diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_first_seen_v2/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_first_seen_v2/query.sql index fdcf1e0d96..e8542070e7 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_first_seen_v2/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_first_seen_v2/query.sql @@ -487,20 +487,17 @@ _current AS ( unioned INNER JOIN first_seen_date AS fsd - ON - ( + ON ( unioned.client_id = fsd.client_id AND unioned.first_seen_timestamp = fsd.first_seen_source_ping_timestamp AND unioned.source_ping = fsd.first_seen_source_ping ) LEFT JOIN second_seen_date AS ssd - ON - unioned.client_id = ssd.client_id + ON unioned.client_id = ssd.client_id LEFT JOIN reported_pings AS pings - ON - unioned.client_id = pings.client_id + ON unioned.client_id = pings.client_id ), _previous AS ( SELECT @@ -559,6 +556,5 @@ FROM _previous FULL JOIN _current -USING - (client_id) + USING (client_id) {% endif %} diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_histogram_aggregates_new_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_histogram_aggregates_new_v1/query.sql index 90164863e9..516a98f513 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_histogram_aggregates_new_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_histogram_aggregates_new_v1/query.sql @@ -52,8 +52,7 @@ version_filtered_new AS ( filtered_aggregates AS hist_aggs LEFT JOIN latest_versions - ON - latest_versions.channel = hist_aggs.channel + ON latest_versions.channel = hist_aggs.channel WHERE CAST(app_version AS INT64) >= (latest_version - 2) ), diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_histogram_aggregates_v2/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_histogram_aggregates_v2/query.sql index 385e6c7311..3f804f5844 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_histogram_aggregates_v2/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_histogram_aggregates_v2/query.sql @@ -113,8 +113,7 @@ clients_histogram_aggregates_old AS ( clients_histogram_aggregates_partition AS hist_aggs LEFT JOIN latest_versions - ON - latest_versions.channel = hist_aggs.channel + ON latest_versions.channel = hist_aggs.channel WHERE app_version >= (latest_version - 2) ), @@ -146,8 +145,7 @@ merged AS ( clients_histogram_aggregates_old AS old_data FULL OUTER JOIN clients_histogram_aggregates_new AS new_data - ON - new_data.join_key = old_data.join_key + ON new_data.join_key = old_data.join_key ) SELECT @submission_date AS submission_date, diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_histogram_bucket_counts_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_histogram_bucket_counts_v1/query.sql index 3e00cc45cb..7ce48e02aa 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_histogram_bucket_counts_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_histogram_bucket_counts_v1/query.sql @@ -55,8 +55,7 @@ data_with_enough_wau AS ( filtered_data table INNER JOIN build_ids - USING - (app_build_id, channel) + USING (app_build_id, channel) ), normalized_histograms AS ( SELECT diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_last_seen_event_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_last_seen_event_v1/query.sql index 71dd1b1841..f11787d326 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_last_seen_event_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_last_seen_event_v1/query.sql @@ -51,5 +51,4 @@ FROM _current FULL JOIN _previous -USING - (client_id) + USING (client_id) diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_last_seen_joined_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_last_seen_joined_v1/query.sql index ad7d8e371f..92fe8cd147 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_last_seen_joined_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_last_seen_joined_v1/query.sql @@ -4,8 +4,7 @@ FROM telemetry_derived.clients_last_seen_v1 AS cls_main LEFT JOIN telemetry_derived.clients_last_seen_event_v1 AS cls_event -USING - (submission_date, sample_id, client_id) + USING (submission_date, sample_id, client_id) WHERE cls_main.submission_date = @submission_date AND cls_event.submission_date = @submission_date diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_last_seen_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_last_seen_v1/query.sql index 8fb1f3b3f0..c7209cd605 100755 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_last_seen_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_last_seen_v1/query.sql @@ -156,9 +156,7 @@ FROM _current FULL JOIN _previous -USING - (client_id) + USING (client_id) LEFT JOIN clients_first_seen_v1 AS cfs -USING - (client_id) + USING (client_id) diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_non_norm_histogram_bucket_counts_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_non_norm_histogram_bucket_counts_v1/query.sql index a974b0202f..b6bb09ff2d 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_non_norm_histogram_bucket_counts_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_non_norm_histogram_bucket_counts_v1/query.sql @@ -74,8 +74,7 @@ all_combos as ( filtered_data table INNER JOIN build_ids - USING - (app_build_id, channel) + USING (app_build_id, channel) CROSS JOIN static_combos combo ), diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_scalar_aggregates_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_scalar_aggregates_v1/query.sql index 68a47c4dac..8a8698c4ca 100755 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_scalar_aggregates_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_scalar_aggregates_v1/query.sql @@ -46,8 +46,7 @@ version_filtered_new AS ( filtered_aggregates AS scalar_aggs LEFT JOIN latest_versions - USING - (channel) + USING (channel) WHERE app_version >= (latest_version - 2) ), @@ -116,8 +115,7 @@ filtered_old AS ( telemetry_derived.clients_scalar_aggregates_v1 AS scalar_aggs LEFT JOIN latest_versions - USING - (channel) + USING (channel) WHERE app_version >= (latest_version - 2) AND submission_date = DATE_SUB(@submission_date, INTERVAL 1 DAY) @@ -135,8 +133,7 @@ joined_new_old AS ( filtered_new AS new_data FULL OUTER JOIN filtered_old AS old_data - USING - (client_id, os, app_version, app_build_id, channel) + USING (client_id, os, app_version, app_build_id, channel) ) SELECT @submission_date AS submission_date, diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_scalar_probe_counts_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_scalar_probe_counts_v1/query.sql index 71d3d32c35..24aa86bc1e 100755 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/clients_scalar_probe_counts_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/clients_scalar_probe_counts_v1/query.sql @@ -242,8 +242,7 @@ bucketed_scalars AS ( UNNEST(scalar_aggregates) LEFT JOIN buckets_by_metric - USING - (metric, key) + USING (metric, key) WHERE metric_type = 'scalar' OR metric_type = 'keyed-scalar' @@ -266,8 +265,7 @@ valid_booleans_scalars AS ( FROM booleans_and_scalars INNER JOIN build_ids - USING - (app_build_id, channel) + USING (app_build_id, channel) ), clients_scalar_bucket_counts AS ( SELECT @@ -332,8 +330,7 @@ aggregated AS ( clients_scalar_bucket_counts LEFT JOIN buckets_by_metric - USING - (metric, key) + USING (metric, key) GROUP BY os, app_version, diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/cohort_daily_statistics_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/cohort_daily_statistics_v1/query.sql index 81168b2d6a..9b22092b73 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/cohort_daily_statistics_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/cohort_daily_statistics_v1/query.sql @@ -55,8 +55,7 @@ activity_cohort_match AS ( cohorts_in_range LEFT JOIN submission_date_activity - USING - (client_id, activity_date) + USING (client_id, activity_date) ) SELECT cohort_date, diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/core_clients_daily_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/core_clients_daily_v1/query.sql index 179f6c4fff..100aad7189 100755 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/core_clients_daily_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/core_clients_daily_v1/query.sql @@ -85,5 +85,4 @@ FROM deduped LEFT JOIN core_clients_first_seen_v1 AS cfs -USING - (client_id) + USING (client_id) diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/core_clients_first_seen_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/core_clients_first_seen_v1/query.sql index 384b2657f2..6ed932bc59 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/core_clients_first_seen_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/core_clients_first_seen_v1/query.sql @@ -23,7 +23,6 @@ FROM _current LEFT JOIN _previous -USING - (client_id) + USING (client_id) WHERE _previous.client_id IS NULL diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/core_clients_last_seen_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/core_clients_last_seen_v1/query.sql index 9c5cc30d43..4bb94791e8 100755 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/core_clients_last_seen_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/core_clients_last_seen_v1/query.sql @@ -37,5 +37,4 @@ FROM _current FULL JOIN _previous -USING - (client_id) + USING (client_id) diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/crash_frames_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/crash_frames_v1/query.sql index d2d40fcaeb..142abcb2ff 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/crash_frames_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/crash_frames_v1/query.sql @@ -15,19 +15,16 @@ FROM JOIN UNNEST(payload.stack_traces.threads) AS _thread WITH OFFSET AS thread_offset -ON - thread_offset = 0 + ON thread_offset = 0 OR thread_offset = payload.stack_traces.crash_info.crashing_thread JOIN UNNEST(_thread.frames) AS _frame WITH OFFSET AS frame_offset -ON - frame_offset < 40 + ON frame_offset < 40 LEFT JOIN UNNEST(payload.stack_traces.modules) AS _module WITH OFFSET AS _module_offset -ON - _frame.module_index = _module_offset + ON _frame.module_index = _module_offset WHERE DATE(submission_timestamp) = @submission_date AND payload.metadata.ipc_channel_error IS NULL diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/crash_symbolicated_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/crash_symbolicated_v1/query.sql index 95da6eaac8..c584b6c2cd 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/crash_symbolicated_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/crash_symbolicated_v1/query.sql @@ -61,8 +61,7 @@ symbolicated_frames AS ( crash_frames LEFT JOIN crash_symbols - USING - (debug_file, debug_id, module_offset) + USING (debug_file, debug_id, module_offset) GROUP BY submission_timestamp, document_id, @@ -96,5 +95,4 @@ FROM crash LEFT JOIN symbolicated_threads -USING - (submission_timestamp, document_id) + USING (submission_timestamp, document_id) diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_cohort_daily_retention_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_cohort_daily_retention_v1/query.sql index 60965cb218..5b92734089 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_cohort_daily_retention_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_cohort_daily_retention_v1/query.sql @@ -74,8 +74,7 @@ activity_cohort_match AS ( cohorts_in_range LEFT JOIN submission_date_activity - USING - (client_id, submission_date) + USING (client_id, submission_date) ) SELECT first_seen_date, diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_funnel_activation_day_6_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_funnel_activation_day_6_v1/query.sql index 4757ded5b8..ff9bd2e9cb 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_funnel_activation_day_6_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_funnel_activation_day_6_v1/query.sql @@ -34,8 +34,7 @@ dist_pop_with_days_seen AS ( dist_pop a LEFT JOIN telemetry.clients_last_seen b - ON - (a.client_id = b.client_id) + ON (a.client_id = b.client_id) WHERE b.submission_date = @submission_date ), @@ -70,8 +69,7 @@ FROM client_conditions LEFT JOIN `moz-fx-data-shared-prod`.static.country_codes_v1 country_codes -ON - (country_codes.code = country_code) + ON (country_codes.code = country_code) WHERE activated = TRUE GROUP BY diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_funnel_installs_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_funnel_installs_v1/query.sql index e1aab1640c..76e0a1ff5f 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_funnel_installs_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_funnel_installs_v1/query.sql @@ -7,7 +7,7 @@ AS return 'Unknown'; } - try { + try { pt1 = input.split('26ua%3D')[1]; pt2 = pt1.split('%')[0]; return pt2; @@ -31,8 +31,7 @@ FROM firefox_installer.install LEFT JOIN `moz-fx-data-shared-prod`.static.country_codes_v1 country_codes -ON - (country_codes.code = normalized_country_code) + ON (country_codes.code = normalized_country_code) WHERE DATE(submission_timestamp) = @submission_date GROUP BY diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_funnel_new_profiles_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_funnel_new_profiles_v1/query.sql index fde7bba735..1a9b1bdc21 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_funnel_new_profiles_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_funnel_new_profiles_v1/query.sql @@ -30,8 +30,7 @@ FROM pop LEFT JOIN `moz-fx-data-shared-prod`.static.country_codes_v1 country_codes -ON - (country_codes.code = country_code) + ON (country_codes.code = country_code) WHERE rn = 1 GROUP BY diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/event_types_history_v1/init.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/event_types_history_v1/init.sql index 3892406c80..b667daaa76 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/event_types_history_v1/init.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/event_types_history_v1/init.sql @@ -52,8 +52,7 @@ event_property_indices AS ( UNNEST(extra) AS event_property LEFT JOIN UNNEST(CAST([] AS ARRAY)) skipped_property - ON - skipped_property = event_property.key + ON skipped_property = event_property.key WHERE skipped_property IS NULL GROUP BY @@ -105,8 +104,7 @@ per_event_property AS ( event_property_value_indices INNER JOIN event_property_indices - USING - (category, event, event_property) + USING (category, event, event_property) WHERE event_property_value_index <= 5000 GROUP BY @@ -135,8 +133,7 @@ per_event AS ( primary_event_types LEFT JOIN per_event_property - USING - (category, event) + USING (category, event) GROUP BY category, event, diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/event_types_history_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/event_types_history_v1/query.sql index 3ffab3b184..8c331c49c3 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/event_types_history_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/event_types_history_v1/query.sql @@ -37,8 +37,7 @@ new_primary_event_types AS ( current_events LEFT JOIN event_types - USING - (category, event) + USING (category, event) WHERE event_types.event IS NULL GROUP BY @@ -86,16 +85,13 @@ new_event_property_indices AS ( UNNEST(extra) AS event_property LEFT JOIN (SELECT * FROM event_types, UNNEST(event_properties)) event_types - USING - (category, event, key) + USING (category, event, key) JOIN all_primary_event_types - USING - (event, category) + USING (event, category) LEFT JOIN UNNEST(CAST([] AS ARRAY)) skipped_property - ON - skipped_property = event_property.key + ON skipped_property = event_property.key WHERE skipped_property IS NULL AND event_types.event IS NULL @@ -158,15 +154,13 @@ new_event_property_value_indices AS ( UNNEST(event_properties) AS existing_event_property, UNNEST(value) AS values ) AS existing_event_type_values - ON - current_events.category = existing_event_type_values.category + ON current_events.category = existing_event_type_values.category AND current_events.event = existing_event_type_values.event AND event_property.key = existing_event_type_values.existing_event_property.key AND event_property.value = existing_event_type_values.values.key JOIN all_event_property_indices - ON - all_event_property_indices.category = current_events.category + ON all_event_property_indices.category = current_events.category AND all_event_property_indices.event = current_events.event AND all_event_property_indices.event_property = event_property.key WHERE @@ -216,8 +210,7 @@ per_event_property AS ( all_event_property_value_indices INNER JOIN all_event_property_indices - USING - (category, event, event_property) + USING (category, event, event_property) GROUP BY category, event, @@ -244,8 +237,7 @@ per_event AS ( all_primary_event_types LEFT JOIN per_event_property - USING - (category, event) + USING (category, event) GROUP BY category, event, diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/events_daily_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/events_daily_v1/query.sql index 9eadde4fbd..9d000d4771 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/events_daily_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/events_daily_v1/query.sql @@ -28,8 +28,7 @@ joined AS ( events INNER JOIN telemetry.event_types event_types - USING - (category, event) + USING (category, event) ) SELECT submission_date, diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/experiment_enrollment_cumulative_population_estimate_v1/view.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/experiment_enrollment_cumulative_population_estimate_v1/view.sql index 28a53aee81..d79aa973fb 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/experiment_enrollment_cumulative_population_estimate_v1/view.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/experiment_enrollment_cumulative_population_estimate_v1/view.sql @@ -48,8 +48,7 @@ cumulative_populations AS ( FROM `moz-fx-data-shared-prod.telemetry_derived.experiment_enrollment_aggregates_live_v1` ) - USING - (window_start, branch, experiment) + USING (window_start, branch, experiment) WINDOW previous_rows_window AS ( PARTITION BY diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/feature_usage_v2/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/feature_usage_v2/query.sql index 792c1ac694..b9ae0b3c5b 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/feature_usage_v2/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/feature_usage_v2/query.sql @@ -561,24 +561,19 @@ all_features AS ( user_type LEFT JOIN main - USING - (client_id, submission_date) + USING (client_id, submission_date) LEFT JOIN events - USING - (client_id, submission_date) + USING (client_id, submission_date) LEFT JOIN activity_stream_events - USING - (client_id, submission_date) + USING (client_id, submission_date) LEFT JOIN activity_stream_sessions - USING - (client_id, submission_date) + USING (client_id, submission_date) LEFT JOIN addons - USING - (client_id, submission_date) + USING (client_id, submission_date) ) SELECT client_id, diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/firefox_desktop_exact_mau28_by_dimensions_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/firefox_desktop_exact_mau28_by_dimensions_v1/query.sql index 86ccf071ae..eadbc2c97f 100755 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/firefox_desktop_exact_mau28_by_dimensions_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/firefox_desktop_exact_mau28_by_dimensions_v1/query.sql @@ -26,8 +26,7 @@ FROM telemetry.clients_last_seen_v1 cls LEFT JOIN static.country_codes_v1 cc -ON - (cls.country = cc.code) + ON (cls.country = cc.code) WHERE client_id IS NOT NULL -- Reprocess all dates by running this query with --parameter=submission_date:DATE:NULL diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/firefox_desktop_usage_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/firefox_desktop_usage_v1/query.sql index d3aaffdeac..adb6a7a473 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/firefox_desktop_usage_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/firefox_desktop_usage_v1/query.sql @@ -78,8 +78,7 @@ nested_counts_by_slice_year_dense AS ( WHERE submission_year = nested_counts_by_slice_year_sparse.submission_year ) - USING - (submission_date) + USING (submission_date) ) AS counts_array ) FROM @@ -109,8 +108,7 @@ FROM exploded LEFT JOIN `moz-fx-data-shared-prod.static.country_codes_v1` AS cc -ON - (exploded.country = cc.code) + ON (exploded.country = cc.code) WINDOW year_slice AS ( PARTITION BY diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/firefox_nondesktop_exact_mau28_by_client_count_dimensions_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/firefox_nondesktop_exact_mau28_by_client_count_dimensions_v1/query.sql index e2215c57c0..1c82a32f4b 100755 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/firefox_nondesktop_exact_mau28_by_client_count_dimensions_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/firefox_nondesktop_exact_mau28_by_client_count_dimensions_v1/query.sql @@ -19,8 +19,7 @@ FROM telemetry.core_clients_last_seen_v1 AS cls LEFT JOIN static.country_codes_v1 AS cc -ON - (cls.country = cc.code) + ON (cls.country = cc.code) WHERE client_id IS NOT NULL -- Reprocess all dates by running this query with --parameter=submission_date:DATE:NULL diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/fog_decision_support_percentiles_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/fog_decision_support_percentiles_v1/query.sql index 5230ff21dc..22bf979faf 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/fog_decision_support_percentiles_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/fog_decision_support_percentiles_v1/query.sql @@ -292,8 +292,7 @@ FROM metrics_grouped FULL JOIN metrics_windowed -USING - (channel, metric_name) + USING (channel, metric_name) UNION ALL SELECT @submission_date AS submission_date, @@ -303,8 +302,7 @@ FROM baseline_grouped FULL JOIN baseline_windowed -USING - (channel, metric_name) + USING (channel, metric_name) UNION ALL SELECT @submission_date AS submission_date, @@ -314,8 +312,7 @@ FROM grouped FULL JOIN windowed -USING - (channel, metric_name) + USING (channel, metric_name) ORDER BY metric_name, channel diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/glam_client_probe_counts_extract_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/glam_client_probe_counts_extract_v1/query.sql index 5bb236ff28..b69053f360 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/glam_client_probe_counts_extract_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/glam_client_probe_counts_extract_v1/query.sql @@ -60,8 +60,7 @@ WITH `moz-fx-data-shared-prod.telemetry_derived.glam_sample_counts_v1` fsc1 INNER JOIN `moz-fx-data-shared-prod.telemetry_derived.glam_sample_counts_v1` fsc2 - ON - fsc1.os = fsc2.os + ON fsc1.os = fsc2.os AND fsc1.app_build_id = fsc2.app_build_id AND fsc1.app_version = fsc2.app_version AND fsc1.metric = fsc2.metric @@ -94,16 +93,14 @@ FROM final_probe_extract cp LEFT JOIN glam_sample_counts sc -ON - sc.os = cp.os + ON sc.os = cp.os AND sc.app_build_id = cp.app_build_id AND sc.app_version = cp.app_version AND sc.metric = cp.metric AND sc.key = cp.key AND sc.process = cp.process AND total_sample IS NOT NULL - AND (sc.agg_type = cp.client_agg_type - OR cp.client_agg_type = '') + AND (sc.agg_type = cp.client_agg_type OR cp.client_agg_type = '') GROUP BY cp.app_version, cp.os, diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/italy_covid19_outage_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/italy_covid19_outage_v1/query.sql index 6076d45a75..73e598baf0 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/italy_covid19_outage_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/italy_covid19_outage_v1/query.sql @@ -108,8 +108,7 @@ final_health_data AS ( health_data_aggregates AS h INNER JOIN DAUs - ON - DAUs.date = h.date + ON DAUs.date = h.date ), -- Compute aggregates for histograms coming from the health ping. histogram_data_sample AS ( @@ -255,23 +254,18 @@ FROM final_health_data AS hd FULL OUTER JOIN DAUs -ON - DAUs.date = hd.date + ON DAUs.date = hd.date FULL OUTER JOIN dns_success_time AS ds -ON - DAUs.date = ds.date + ON DAUs.date = ds.date FULL OUTER JOIN dns_failure_time AS df -ON - DAUs.date = df.date + ON DAUs.date = df.date FULL OUTER JOIN dns_failure_counts AS dfc -ON - DAUs.date = dfc.date + ON DAUs.date = dfc.date FULL OUTER JOIN tls_handshake_time AS tls -ON - DAUs.date = tls.date + ON DAUs.date = tls.date ORDER BY 1 diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/mobile_usage_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/mobile_usage_v1/query.sql index f2f765b73b..0b0dbacac9 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/mobile_usage_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/mobile_usage_v1/query.sql @@ -70,8 +70,7 @@ nested_counts_by_slice_year_dense AS ( WHERE submission_year = nested_counts_by_slice_year_sparse.submission_year ) - USING - (submission_date) + USING (submission_date) ) AS counts_array ) FROM diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/newtab_interactions_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/newtab_interactions_v1/query.sql index 9e0558e666..8291012acf 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/newtab_interactions_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/newtab_interactions_v1/query.sql @@ -283,8 +283,7 @@ side_filled AS ( aggregated_newtab_activity LEFT JOIN client_profile_info - USING - (legacy_telemetry_client_id) + USING (legacy_telemetry_client_id) ) SELECT * EXCEPT (visit_had_any_interaction) diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/newtab_visits_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/newtab_visits_v1/query.sql index b9d477ed57..566964260c 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/newtab_visits_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/newtab_visits_v1/query.sql @@ -163,8 +163,7 @@ topsites_events AS ( events_unnested LEFT JOIN UNNEST(metrics.string_list.newtab_sov_allocation) sov - ON - SAFE_CAST(mozfun.map.get_key(event_details, "position") AS INT64) = SAFE_CAST( + ON SAFE_CAST(mozfun.map.get_key(event_details, "position") AS INT64) = SAFE_CAST( JSON_EXTRACT(sov, "$.pos") AS INT64 ) WHERE @@ -271,16 +270,13 @@ combined_newtab_activity AS ( visit_metadata LEFT JOIN search_summary - USING - (newtab_visit_id) + USING (newtab_visit_id) LEFT JOIN topsites_summary - USING - (newtab_visit_id) + USING (newtab_visit_id) LEFT JOIN pocket_summary - USING - (newtab_visit_id) + USING (newtab_visit_id) WHERE -- Keep only rows with interactions, unless we receive a valid newtab.opened event. -- This is meant to drop only interactions that only have a newtab.closed event on the same partition @@ -308,5 +304,4 @@ FROM combined_newtab_activity LEFT JOIN client_profile_info -USING - (legacy_telemetry_client_id) + USING (legacy_telemetry_client_id) diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/public_data_report_user_activity_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/public_data_report_user_activity_v1/query.sql index c195170c89..6ed10476a2 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/public_data_report_user_activity_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/public_data_report_user_activity_v1/query.sql @@ -24,8 +24,7 @@ sample AS ( UNNEST([country, 'Worldwide']) AS country_group LEFT JOIN countries AS cn - ON - cn.code = country_group + ON cn.code = country_group WHERE COALESCE(cn.name, country_group) IN ( 'Worldwide', @@ -185,8 +184,7 @@ active_clients_with_latest_releases AS ( active_clients_weekly JOIN latest_releases - ON - latest_releases.day <= active_clients_weekly.last_day_seen + ON latest_releases.day <= active_clients_weekly.last_day_seen WHERE client_id IS NOT NULL GROUP BY @@ -250,8 +248,7 @@ addon_ratios AS ( addon_counts JOIN mau_wau - USING - (week_start, country_name) + USING (week_start, country_name) ), top_addons AS ( SELECT @@ -320,8 +317,7 @@ locale_ratios AS ( locale_counts JOIN mau_wau - USING - (week_start, country_name) + USING (week_start, country_name) ), top_locales AS ( SELECT @@ -349,29 +345,22 @@ FROM mau_wau JOIN daily_usage -USING - (week_start, country_name) + USING (week_start, country_name) JOIN intensity -USING - (week_start, country_name) + USING (week_start, country_name) JOIN new_profile_rate -USING - (week_start, country_name) + USING (week_start, country_name) JOIN latest_version_ratio -USING - (week_start, country_name) + USING (week_start, country_name) JOIN top_addons -USING - (week_start, country_name) + USING (week_start, country_name) JOIN top_locales -USING - (week_start, country_name) + USING (week_start, country_name) JOIN has_addon -USING - (week_start, country_name) + USING (week_start, country_name) diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/smoot_usage_fxa_v2/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/smoot_usage_fxa_v2/query.sql index a42178fa27..0cd6930f28 100755 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/smoot_usage_fxa_v2/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/smoot_usage_fxa_v2/query.sql @@ -13,8 +13,7 @@ WITH `moz-fx-data-shared-prod.firefox_accounts_derived.fxa_users_last_seen_v1` AS fxa LEFT JOIN `moz-fx-data-shared-prod.static.country_names_v1` AS country_names - ON - fxa.country = country_names.`name` ), + ON fxa.country = country_names.`name` ), -- nested AS ( SELECT diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/sponsored_tiles_clients_daily_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/sponsored_tiles_clients_daily_v1/query.sql index 6b7b0873af..fe000b87ef 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/sponsored_tiles_clients_daily_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/sponsored_tiles_clients_daily_v1/query.sql @@ -187,16 +187,13 @@ FROM (SELECT * FROM unified_metrics WHERE normalized_os NOT IN ("Android", "iOS")) desktop_unified LEFT JOIN clicks_main -USING - (client_id, submission_date) + USING (client_id, submission_date) LEFT JOIN impressions_main -USING - (client_id, submission_date) + USING (client_id, submission_date) LEFT JOIN desktop_activity_stream_events -USING - (client_id, submission_date) + USING (client_id, submission_date) -- add experiments data LEFT JOIN ( @@ -209,8 +206,7 @@ LEFT JOIN WHERE submission_date = @submission_date ) -USING - (submission_date, client_id) + USING (submission_date, client_id) UNION ALL --- iOS SELECT @@ -233,8 +229,7 @@ FROM (SELECT * FROM unified_metrics WHERE normalized_os = "iOS") ios_unified LEFT JOIN ios_data -USING - (submission_date, client_id) + USING (submission_date, client_id) -- add experiments data LEFT JOIN ( @@ -257,8 +252,7 @@ LEFT JOIN GROUP BY client_info.client_id ) experiments_info -USING - (submission_date, client_id) + USING (submission_date, client_id) UNION ALL --- Android SELECT @@ -288,8 +282,7 @@ FROM ) android_unified LEFT JOIN android_events -USING - (submission_date, client_id) + USING (submission_date, client_id) -- add experiments data LEFT JOIN ( @@ -312,5 +305,4 @@ LEFT JOIN GROUP BY client_info.client_id ) -USING - (submission_date, client_id) + USING (submission_date, client_id) diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/suggest_clients_daily_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/suggest_clients_daily_v1/query.sql index 27fb6df719..47aa42b449 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/suggest_clients_daily_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/suggest_clients_daily_v1/query.sql @@ -153,5 +153,4 @@ FROM events INNER JOIN clients -USING - (submission_date, client_id) + USING (submission_date, client_id) diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/unified_metrics_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/unified_metrics_v1/query.sql index 6bee67b395..815b4e8819 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/unified_metrics_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/unified_metrics_v1/query.sql @@ -211,8 +211,7 @@ search_metrics AS ( unioned LEFT JOIN search_clients s - ON - unioned.client_id = s.client_id + ON unioned.client_id = s.client_id AND unioned.submission_date = s.submission_date GROUP BY client_id, @@ -287,8 +286,7 @@ mobile_with_searches AS ( unioned LEFT JOIN search_metrics search - ON - search.client_id = unioned.client_id + ON search.client_id = unioned.client_id AND search.submission_date = unioned.submission_date ), desktop AS ( diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/urlbar_clients_daily_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/urlbar_clients_daily_v1/query.sql index 90716112ed..7679f890bb 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/urlbar_clients_daily_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/urlbar_clients_daily_v1/query.sql @@ -178,5 +178,4 @@ FROM combined_urlbar_picked FULL OUTER JOIN count_picked -USING - (submission_date, client_id) + USING (submission_date, client_id) diff --git a/sql/moz-fx-data-shared-prod/telemetry_dev_cycle_derived/glean_metrics_stats_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_dev_cycle_derived/glean_metrics_stats_v1/query.sql index 92c0257751..d9e1acfb0f 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_dev_cycle_derived/glean_metrics_stats_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_dev_cycle_derived/glean_metrics_stats_v1/query.sql @@ -17,8 +17,7 @@ WITH glean_app_with_parsed_expiry_date AS ( `telemetry_dev_cycle_external.glean_metrics_stats_v1` AS glean LEFT JOIN `telemetry_dev_cycle_derived.firefox_major_release_dates_v1` AS releases - ON - glean.expires = CAST(releases.version AS STRING) + ON glean.expires = CAST(releases.version AS STRING) AND COALESCE( REGEXP_EXTRACT(glean.glean_app, r"beta"), REGEXP_EXTRACT(glean.glean_app, r"nightly"), diff --git a/sql/moz-fx-data-shared-prod/telemetry_dev_cycle_derived/telemetry_probes_stats_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_dev_cycle_derived/telemetry_probes_stats_v1/query.sql index 6875307ea7..25954b9094 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_dev_cycle_derived/telemetry_probes_stats_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_dev_cycle_derived/telemetry_probes_stats_v1/query.sql @@ -37,8 +37,7 @@ final AS ( telemetry_probes_with_expiration AS probes LEFT JOIN `telemetry_dev_cycle_derived.firefox_major_release_dates_v1` AS release_dates - ON - probes.channel = release_dates.channel + ON probes.channel = release_dates.channel AND probes.expired_version_helper = release_dates.version ) SELECT diff --git a/sql/moz-fx-data-shared-prod/udf/add_monthly_searches/udf.sql b/sql/moz-fx-data-shared-prod/udf/add_monthly_searches/udf.sql index cd480a5ab3..bb958342e7 100644 --- a/sql/moz-fx-data-shared-prod/udf/add_monthly_searches/udf.sql +++ b/sql/moz-fx-data-shared-prod/udf/add_monthly_searches/udf.sql @@ -55,8 +55,7 @@ CREATE OR REPLACE FUNCTION udf.add_monthly_searches( curr_tbl AS c FULL OUTER JOIN prev_tbl AS p - USING - (key) + USING (key) ) ); @@ -399,5 +398,4 @@ FROM results INNER JOIN expected -USING - (p_type, c_type, date); + USING (p_type, c_type, date); diff --git a/sql/moz-fx-data-shared-prod/udf/combine_days_seen_maps/udf.sql b/sql/moz-fx-data-shared-prod/udf/combine_days_seen_maps/udf.sql index 7a30bad651..cbcb8ae1eb 100644 --- a/sql/moz-fx-data-shared-prod/udf/combine_days_seen_maps/udf.sql +++ b/sql/moz-fx-data-shared-prod/udf/combine_days_seen_maps/udf.sql @@ -28,8 +28,7 @@ CREATE OR REPLACE FUNCTION udf.combine_days_seen_maps( UNNEST(prev) AS prev LEFT JOIN UNNEST(curr) AS curr - USING - (key) + USING (key) WHERE udf.combine_adjacent_days_28_bits(prev.value, curr.value) > 0 ), @@ -42,8 +41,7 @@ CREATE OR REPLACE FUNCTION udf.combine_days_seen_maps( UNNEST(curr) AS curr LEFT JOIN UNNEST(prev) AS prev - USING - (key) + USING (key) WHERE prev IS NULL ) diff --git a/sql/moz-fx-data-shared-prod/udf/combine_experiment_days/udf.sql b/sql/moz-fx-data-shared-prod/udf/combine_experiment_days/udf.sql index e95dad3ce9..a431aae4a3 100644 --- a/sql/moz-fx-data-shared-prod/udf/combine_experiment_days/udf.sql +++ b/sql/moz-fx-data-shared-prod/udf/combine_experiment_days/udf.sql @@ -29,8 +29,7 @@ CREATE OR REPLACE FUNCTION udf.combine_experiment_days( UNNEST(prev) AS prev LEFT JOIN UNNEST(curr) AS curr - USING - (experiment, branch) + USING (experiment, branch) WHERE udf.combine_adjacent_days_28_bits(prev.bits, curr.bits) > 0 ), @@ -44,8 +43,7 @@ CREATE OR REPLACE FUNCTION udf.combine_experiment_days( UNNEST(curr) AS curr LEFT JOIN UNNEST(prev) AS prev - USING - (experiment, branch) + USING (experiment, branch) WHERE prev IS NULL ) diff --git a/sql/moz-fx-data-shared-prod/udf/vector_add/udf.sql b/sql/moz-fx-data-shared-prod/udf/vector_add/udf.sql index 5dfc67004c..4cda0354ce 100644 --- a/sql/moz-fx-data-shared-prod/udf/vector_add/udf.sql +++ b/sql/moz-fx-data-shared-prod/udf/vector_add/udf.sql @@ -26,8 +26,7 @@ CREATE OR REPLACE FUNCTION udf.vector_add(a ARRAY, b ARRAY) AS ( a_unnested FULL OUTER JOIN b_unnested - ON - _a_off = _b_off + ON _a_off = _b_off ORDER BY COALESCE(_a_off, _b_off) ASC ) diff --git a/sql/mozfun/assert/map_entries_equals/udf.sql b/sql/mozfun/assert/map_entries_equals/udf.sql index 0b84d7f179..41903c3ddb 100644 --- a/sql/mozfun/assert/map_entries_equals/udf.sql +++ b/sql/mozfun/assert/map_entries_equals/udf.sql @@ -17,7 +17,6 @@ RETURNS BOOLEAN AS ( -- BQ does not allow full array scans with FULL join -- so we trick it using a subquery (SELECT * FROM UNNEST(expected)) AS e - USING - (key) + USING (key) ) ); diff --git a/sql/mozfun/assert/map_equals/udf.sql b/sql/mozfun/assert/map_equals/udf.sql index 70cdefad40..e4b9ec2dce 100644 --- a/sql/mozfun/assert/map_equals/udf.sql +++ b/sql/mozfun/assert/map_equals/udf.sql @@ -10,8 +10,7 @@ RETURNS BOOLEAN AS ( -- BQ does not allow full array scans with FULL join -- so we trick it using a subquery (SELECT * FROM UNNEST(actual)) AS a - USING - (key) + USING (key) WHERE e.value != a.value OR (e.value IS NULL AND a.value IS NOT NULL) diff --git a/sql/mozfun/glam/histogram_fill_buckets/udf.sql b/sql/mozfun/glam/histogram_fill_buckets/udf.sql index b90c2a39e4..623ead4aee 100644 --- a/sql/mozfun/glam/histogram_fill_buckets/udf.sql +++ b/sql/mozfun/glam/histogram_fill_buckets/udf.sql @@ -13,8 +13,7 @@ RETURNS ARRAY> AS ( UNNEST(buckets) AS key LEFT JOIN UNNEST(input_map) AS e - ON - key = e.key + ON key = e.key ORDER BY SAFE_CAST(key AS FLOAT64) ) diff --git a/sql/mozfun/glam/histogram_fill_buckets_dirichlet/udf.sql b/sql/mozfun/glam/histogram_fill_buckets_dirichlet/udf.sql index 79fc5e394f..b0b321a4ae 100644 --- a/sql/mozfun/glam/histogram_fill_buckets_dirichlet/udf.sql +++ b/sql/mozfun/glam/histogram_fill_buckets_dirichlet/udf.sql @@ -29,8 +29,7 @@ RETURNS ARRAY> AS ( UNNEST(buckets) AS key LEFT JOIN UNNEST(input_map) AS e - ON - key = e.key + ON key = e.key ORDER BY SAFE_CAST(key AS FLOAT64) ) diff --git a/sql/mozfun/hist/percentiles/udf.sql b/sql/mozfun/hist/percentiles/udf.sql index 0fb0635df9..1f1d52edb0 100644 --- a/sql/mozfun/hist/percentiles/udf.sql +++ b/sql/mozfun/hist/percentiles/udf.sql @@ -22,8 +22,7 @@ RETURNS ARRAY> AS ( ) INNER JOIN UNNEST(percentiles) AS percentile - ON - cumulative_fraction >= percentile + ON cumulative_fraction >= percentile GROUP BY percentile ORDER BY diff --git a/sql/mozfun/map/set_key/udf.sql b/sql/mozfun/map/set_key/udf.sql index e87f2fe2b8..f56c916f15 100644 --- a/sql/mozfun/map/set_key/udf.sql +++ b/sql/mozfun/map/set_key/udf.sql @@ -15,8 +15,7 @@ CREATE OR REPLACE FUNCTION map.set_key(map ANY TYPE, new_key ANY TYPE, new_value -- BQ doesn't allow you to FULL OUTER JOIN an -- unnested array directly, so we use a subquery (SELECT * FROM UNNEST(map)) AS existing_data - USING - (key) + USING (key) ) ) ); diff --git a/sql_generators/active_users/templates/desktop_checks.sql b/sql_generators/active_users/templates/desktop_checks.sql index b9dc099178..0f962db14e 100644 --- a/sql_generators/active_users/templates/desktop_checks.sql +++ b/sql_generators/active_users/templates/desktop_checks.sql @@ -66,8 +66,7 @@ client_summary AS ( live_table_dau_count_base LEFT JOIN overactive - USING - (client_id) + USING (client_id) WHERE overactive.client_id IS NULL GROUP BY @@ -89,8 +88,7 @@ live_table_dau_count AS ( client_summary LEFT JOIN last_seen - USING - (client_id) + USING (client_id) ) SELECT IF( @@ -145,8 +143,7 @@ distinct_client_count AS ( distinct_client_count_base FULL OUTER JOIN overactive - USING - (client_id) + USING (client_id) WHERE overactive.client_id IS NULL ) diff --git a/sql_generators/active_users/templates/desktop_query.sql b/sql_generators/active_users/templates/desktop_query.sql index 678fbcfc4d..8ebd9aee5c 100644 --- a/sql_generators/active_users/templates/desktop_query.sql +++ b/sql_generators/active_users/templates/desktop_query.sql @@ -59,8 +59,7 @@ todays_metrics_enriched AS ( todays_metrics LEFT JOIN `mozdata.static.csa_gblmkt_languages` AS languages - ON - todays_metrics.locale = languages.code + ON todays_metrics.locale = languages.code ) SELECT todays_metrics_enriched.* EXCEPT ( diff --git a/sql_generators/active_users/templates/fenix_checks.sql b/sql_generators/active_users/templates/fenix_checks.sql index a0edb6e75d..4f2ada87f2 100644 --- a/sql_generators/active_users/templates/fenix_checks.sql +++ b/sql_generators/active_users/templates/fenix_checks.sql @@ -98,8 +98,7 @@ distinct_client_count_base AS ( distinct_client_count_nightly_base LEFT JOIN `moz-fx-data-shared-prod.fenix.baseline_clients_last_seen` AS baseline_clients_last_seen - USING - (client_id) + USING (client_id) WHERE baseline_clients_last_seen.submission_date = @submission_date AND baseline_clients_last_seen.days_since_seen = 0 diff --git a/sql_generators/active_users/templates/focus_android_query.sql b/sql_generators/active_users/templates/focus_android_query.sql index e15d29dd59..81446b243a 100644 --- a/sql_generators/active_users/templates/focus_android_query.sql +++ b/sql_generators/active_users/templates/focus_android_query.sql @@ -87,8 +87,7 @@ search_metrics AS ( unioned LEFT JOIN search_clients s - ON - unioned.client_id = s.client_id + ON unioned.client_id = s.client_id AND unioned.submission_date = s.submission_date GROUP BY client_id, @@ -162,8 +161,7 @@ unioned_with_searches AS ( unioned LEFT JOIN search_metrics search - ON - search.client_id = unioned.client_id + ON search.client_id = unioned.client_id AND search.submission_date = unioned.submission_date ), todays_metrics AS ( @@ -215,8 +213,7 @@ todays_metrics_enriched AS ( todays_metrics LEFT JOIN `mozdata.static.csa_gblmkt_languages` AS languages - ON - todays_metrics.locale = languages.code + ON todays_metrics.locale = languages.code ) SELECT todays_metrics_enriched.* EXCEPT ( diff --git a/sql_generators/active_users/templates/mobile_query.sql b/sql_generators/active_users/templates/mobile_query.sql index 18a1c33469..e73e2e9451 100644 --- a/sql_generators/active_users/templates/mobile_query.sql +++ b/sql_generators/active_users/templates/mobile_query.sql @@ -71,8 +71,7 @@ search_metrics AS ( baseline LEFT JOIN search_clients s - ON - baseline.client_id = s.client_id + ON baseline.client_id = s.client_id AND baseline.submission_date = s.submission_date GROUP BY client_id, @@ -146,8 +145,7 @@ baseline_with_searches AS ( baseline LEFT JOIN search_metrics search - ON - search.client_id = baseline.client_id + ON search.client_id = baseline.client_id AND search.submission_date = baseline.submission_date ), baseline_with_searches_and_attribution AS ( @@ -159,8 +157,7 @@ baseline_with_searches_and_attribution AS ( baseline_with_searches baseline LEFT JOIN attribution_data - USING - (client_id) + USING (client_id) ), todays_metrics AS ( SELECT @@ -211,8 +208,7 @@ todays_metrics_enriched AS ( todays_metrics LEFT JOIN `mozdata.static.csa_gblmkt_languages` AS languages - ON - todays_metrics.locale = languages.code + ON todays_metrics.locale = languages.code ) SELECT todays_metrics_enriched.* EXCEPT ( diff --git a/sql_generators/active_users_deletion_requests/templates/desktop_deletion_request_query.sql b/sql_generators/active_users_deletion_requests/templates/desktop_deletion_request_query.sql index 220197b55f..8c0a649471 100644 --- a/sql_generators/active_users_deletion_requests/templates/desktop_deletion_request_query.sql +++ b/sql_generators/active_users_deletion_requests/templates/desktop_deletion_request_query.sql @@ -45,8 +45,7 @@ WITH todays_metrics AS ( telemetry.clients_last_seen AS last_seen INNER JOIN `{{ app_name }}.deletion_request` AS request - ON - client_info.client_id = client_id + ON client_info.client_id = client_id WHERE last_seen.submission_date >= '2021-01-01' AND last_seen.submission_date <= @end_date @@ -67,8 +66,7 @@ todays_metrics_enriched AS ( todays_metrics LEFT JOIN `mozdata.static.csa_gblmkt_languages` AS languages - ON - todays_metrics.locale = languages.code + ON todays_metrics.locale = languages.code ) SELECT todays_metrics_enriched.* EXCEPT ( diff --git a/sql_generators/active_users_deletion_requests/templates/mobile_deletion_request_query.sql b/sql_generators/active_users_deletion_requests/templates/mobile_deletion_request_query.sql index c51b40bade..ab7747dffd 100644 --- a/sql_generators/active_users_deletion_requests/templates/mobile_deletion_request_query.sql +++ b/sql_generators/active_users_deletion_requests/templates/mobile_deletion_request_query.sql @@ -29,8 +29,7 @@ WITH baseline AS ( `{{ project_id }}.{{ app_name }}.clients_last_seen_joined` AS joined INNER JOIN `{{ app_name }}.deletion_request` AS request - ON - client_info.client_id = client_id + ON client_info.client_id = client_id WHERE joined.submission_date <= @end_date AND DATE(request.submission_timestamp) @@ -49,8 +48,7 @@ search_clients AS ( `moz-fx-data-shared-prod.search_derived.mobile_search_clients_daily_v1` search INNER JOIN `{{ app_name }}.deletion_request` AS request - ON - client_info.client_id = client_id + ON client_info.client_id = client_id WHERE search.submission_date <= @end_date AND DATE(request.submission_timestamp) @@ -69,8 +67,7 @@ search_metrics AS ( baseline LEFT JOIN search_clients s - ON - baseline.client_id = s.client_id + ON baseline.client_id = s.client_id AND baseline.submission_date = s.submission_date GROUP BY client_id, @@ -144,8 +141,7 @@ baseline_with_searches AS ( baseline LEFT JOIN search_metrics search - ON - search.client_id = baseline.client_id + ON search.client_id = baseline.client_id AND search.submission_date = baseline.submission_date ), today_metrics AS ( @@ -195,8 +191,7 @@ today_metrics_enriched AS ( today_metrics LEFT JOIN `mozdata.static.csa_gblmkt_languages` AS languages - ON - today_metrics.locale = languages.code + ON today_metrics.locale = languages.code ) SELECT today_metrics_enriched.* EXCEPT ( diff --git a/sql_generators/events_daily/templates/event_types_history_v1/init.sql b/sql_generators/events_daily/templates/event_types_history_v1/init.sql index b97767eb4e..fb0061aff7 100644 --- a/sql_generators/events_daily/templates/event_types_history_v1/init.sql +++ b/sql_generators/events_daily/templates/event_types_history_v1/init.sql @@ -71,8 +71,7 @@ event_property_indices AS ( UNNEST( CAST([{% for property in skipped_properties %}'{{ property }}'{% if not loop.last %},{% endif %}{% endfor %}] AS ARRAY) ) skipped_property - ON - skipped_property = event_property.key + ON skipped_property = event_property.key WHERE skipped_property IS NULL GROUP BY @@ -124,8 +123,7 @@ per_event_property AS ( event_property_value_indices INNER JOIN event_property_indices - USING - (category, event, event_property) + USING (category, event, event_property) WHERE event_property_value_index <= {{ max_property_values }} GROUP BY @@ -154,8 +152,7 @@ per_event AS ( primary_event_types LEFT JOIN per_event_property - USING - (category, event) + USING (category, event) GROUP BY category, event, diff --git a/sql_generators/events_daily/templates/event_types_history_v1/query.sql b/sql_generators/events_daily/templates/event_types_history_v1/query.sql index b3180f83f2..16cd834dda 100644 --- a/sql_generators/events_daily/templates/event_types_history_v1/query.sql +++ b/sql_generators/events_daily/templates/event_types_history_v1/query.sql @@ -54,8 +54,7 @@ new_primary_event_types AS ( current_events LEFT JOIN event_types - USING - (category, event) + USING (category, event) WHERE event_types.event IS NULL GROUP BY @@ -98,18 +97,15 @@ new_event_property_indices AS ( UNNEST(extra) AS event_property LEFT JOIN (SELECT * FROM event_types, UNNEST(event_properties)) event_types - USING - (category, event, key) + USING (category, event, key) JOIN all_primary_event_types - USING - (event, category) + USING (event, category) LEFT JOIN UNNEST( CAST([{% for property in skipped_properties %}'{{ property }}'{% if not loop.last %},{% endif %}{% endfor %}] AS ARRAY) ) skipped_property - ON - skipped_property = event_property.key + ON skipped_property = event_property.key WHERE skipped_property IS NULL AND event_types.event IS NULL @@ -172,15 +168,13 @@ new_event_property_value_indices AS ( UNNEST(event_properties) AS existing_event_property, UNNEST(value) AS `values` ) AS existing_event_type_values - ON - current_events.category = existing_event_type_values.category + ON current_events.category = existing_event_type_values.category AND current_events.event = existing_event_type_values.event AND event_property.key = existing_event_type_values.existing_event_property.key AND event_property.value = existing_event_type_values.`values`.key JOIN all_event_property_indices - ON - all_event_property_indices.category = current_events.category + ON all_event_property_indices.category = current_events.category AND all_event_property_indices.event = current_events.event AND all_event_property_indices.event_property = event_property.key WHERE @@ -230,8 +224,7 @@ per_event_property AS ( all_event_property_value_indices INNER JOIN all_event_property_indices - USING - (category, event, event_property) + USING (category, event, event_property) GROUP BY category, event, @@ -258,8 +251,7 @@ per_event AS ( all_primary_event_types LEFT JOIN per_event_property - USING - (category, event) + USING (category, event) GROUP BY category, event, diff --git a/sql_generators/events_daily/templates/events_daily_v1/query.sql b/sql_generators/events_daily/templates/events_daily_v1/query.sql index c367a03a83..d0a07f3ba9 100644 --- a/sql_generators/events_daily/templates/events_daily_v1/query.sql +++ b/sql_generators/events_daily/templates/events_daily_v1/query.sql @@ -72,8 +72,7 @@ joined AS ( events INNER JOIN {{ dataset }}.event_types event_types - USING - (category, event) + USING (category, event) ) SELECT submission_date, diff --git a/sql_generators/funnels/templates/funnel.sql b/sql_generators/funnels/templates/funnel.sql index bf1535dd4e..23ac4aeb09 100644 --- a/sql_generators/funnels/templates/funnel.sql +++ b/sql_generators/funnels/templates/funnel.sql @@ -26,9 +26,8 @@ {{ data_sources[steps[step_name].data_source].from_expression }} {% if not loop.first and steps[step_name].join_previous_step_on %} INNER JOIN {{ funnel_name }}_{{ loop.previtem }} AS prev - ON - prev.submission_date = {{ data_sources[steps[step_name].data_source].submission_date_column }} AND - prev.join_key = {{ steps[step_name].join_previous_step_on }} + ON prev.submission_date = {{ data_sources[steps[step_name].data_source].submission_date_column }} + AND prev.join_key = {{ steps[step_name].join_previous_step_on }} {% endif %} {% if funnel.dimensions %} {% for dimension_name in funnel.dimensions %} @@ -43,7 +42,7 @@ {{ data_sources[dimensions[dimension_name].data_source].from_expression }} WHERE {{ data_sources[dimensions[dimension_name].data_source].submission_date_column }} = @submission_date ) AS dimension_source_{{ dimension_name }} - ON dimension_source_{{ dimension_name }}.client_id = {{ data_sources[steps[step_name].data_source].client_id_column }} + ON dimension_source_{{ dimension_name }}.client_id = {{ data_sources[steps[step_name].data_source].client_id_column }} {% endif %} {% endfor %} {% endif %} @@ -136,13 +135,13 @@ merged_funnels AS ( {{ funnel_name }}_{{ step_name }}_aggregated {% else %} FULL OUTER JOIN {{ funnel_name }}_{{ step_name }}_aggregated - USING ( - submission_date, - {% for dimension_name in dimensions.keys() %} - {{ dimension_name }}, - {% endfor %} - funnel - ) + USING ( + submission_date, + {% for dimension_name in dimensions.keys() %} + {{ dimension_name }}, + {% endfor %} + funnel + ) {% endif %} {% endfor %} {% endfor %} diff --git a/sql_generators/funnels/tests/test_funnel b/sql_generators/funnels/tests/test_funnel index d9760a2e78..b65cd61406 100644 --- a/sql_generators/funnels/tests/test_funnel +++ b/sql_generators/funnels/tests/test_funnel @@ -215,24 +215,19 @@ merged_funnels AS ( subscription_funnel_signup_aggregated FULL OUTER JOIN subscription_funnel_verify_aggregated - USING - (submission_date, funnel) + USING (submission_date, funnel) FULL OUTER JOIN subscription_funnel_start_subscription_aggregated - USING - (submission_date, funnel) + USING (submission_date, funnel) FULL OUTER JOIN subscription_error_funnel_signup_aggregated - USING - (submission_date, funnel) + USING (submission_date, funnel) FULL OUTER JOIN subscription_error_funnel_verify_aggregated - USING - (submission_date, funnel) + USING (submission_date, funnel) FULL OUTER JOIN subscription_error_funnel_error_subscription_aggregated - USING - (submission_date, funnel) + USING (submission_date, funnel) ) SELECT * diff --git a/sql_generators/glean_usage/templates/baseline_clients_daily_v1.query.sql b/sql_generators/glean_usage/templates/baseline_clients_daily_v1.query.sql index 09f1bd9ad2..f20e2c7304 100644 --- a/sql_generators/glean_usage/templates/baseline_clients_daily_v1.query.sql +++ b/sql_generators/glean_usage/templates/baseline_clients_daily_v1.query.sql @@ -144,8 +144,7 @@ joined as ( windowed AS cd LEFT JOIN `{{ first_seen_table }}` AS cfs - USING - (client_id) + USING (client_id) WHERE _n = 1 ) diff --git a/sql_generators/glean_usage/templates/baseline_clients_first_seen_v1.query.sql b/sql_generators/glean_usage/templates/baseline_clients_first_seen_v1.query.sql index 58973b2e8d..6bfd5bd178 100644 --- a/sql_generators/glean_usage/templates/baseline_clients_first_seen_v1.query.sql +++ b/sql_generators/glean_usage/templates/baseline_clients_first_seen_v1.query.sql @@ -26,8 +26,7 @@ _current AS ( _baseline LEFT JOIN _core_clients_first_seen - USING - (client_id) + USING (client_id) ), _previous AS ( SELECT @@ -43,8 +42,7 @@ _previous AS ( `{{ first_seen_table }}` fs LEFT JOIN _core_clients_first_seen core - USING - (client_id) + USING (client_id) WHERE fs.first_seen_date > "2010-01-01" AND fs.first_seen_date < @submission_date @@ -89,8 +87,7 @@ _previous AS ( _current FULL JOIN _previous - USING - (client_id) + USING (client_id) ) -- added this as the result of bug#1788650 diff --git a/sql_generators/glean_usage/templates/baseline_clients_last_seen_v1.query.sql b/sql_generators/glean_usage/templates/baseline_clients_last_seen_v1.query.sql index 70395853a3..506c674e80 100644 --- a/sql_generators/glean_usage/templates/baseline_clients_last_seen_v1.query.sql +++ b/sql_generators/glean_usage/templates/baseline_clients_last_seen_v1.query.sql @@ -72,7 +72,6 @@ FROM _current FULL JOIN _previous -USING - (client_id) + USING (client_id) {% endif %} diff --git a/sql_generators/glean_usage/templates/event_flow_monitoring_aggregates_v1.script.sql b/sql_generators/glean_usage/templates/event_flow_monitoring_aggregates_v1.script.sql index 5a32e14261..f0e07acec1 100644 --- a/sql_generators/glean_usage/templates/event_flow_monitoring_aggregates_v1.script.sql +++ b/sql_generators/glean_usage/templates/event_flow_monitoring_aggregates_v1.script.sql @@ -101,8 +101,7 @@ CREATE TEMP TABLE unnested_events AS prev_event INNER JOIN unnested_events AS cur_event - ON - prev_event.flow_id = cur_event.flow_id + ON prev_event.flow_id = cur_event.flow_id AND prev_event.event_offset = cur_event.event_offset - 1 GROUP BY flow_id, @@ -168,10 +167,8 @@ CREATE TEMP TABLE MERGE `{{ project_id }}.{{ target_table }}` r -USING - event_flows f -ON - r.flow_id = f.flow_id + USING event_flows f + ON r.flow_id = f.flow_id -- look back up to 3 days to see if a flow has seen new events and needs to be replaced AND r.submission_date > DATE_SUB(@submission_date, INTERVAL 3 DAY) WHEN NOT MATCHED diff --git a/sql_generators/glean_usage/templates/macros.sql b/sql_generators/glean_usage/templates/macros.sql index ddcc8499a4..cfbe91efdf 100644 --- a/sql_generators/glean_usage/templates/macros.sql +++ b/sql_generators/glean_usage/templates/macros.sql @@ -25,8 +25,7 @@ _core_clients_first_seen AS ( _fennec_id_lookup JOIN _core - ON - _fennec_id_lookup.fennec_client_id = _core.client_id + ON _fennec_id_lookup.fennec_client_id = _core.client_id GROUP BY _fennec_id_lookup.client_id ) diff --git a/sql_generators/glean_usage/templates/metrics_clients_last_seen.query.sql b/sql_generators/glean_usage/templates/metrics_clients_last_seen.query.sql index d8e0a87f4f..a11d2b3688 100644 --- a/sql_generators/glean_usage/templates/metrics_clients_last_seen.query.sql +++ b/sql_generators/glean_usage/templates/metrics_clients_last_seen.query.sql @@ -39,11 +39,10 @@ FROM _previous FULL JOIN _current -ON - _previous.client_id = _current.client_id AND - _previous.sample_id = _current.sample_id AND - ( - _previous.normalized_channel = _current.normalized_channel OR - (_previous.normalized_channel IS NULL AND _current.normalized_channel IS NULL) + ON _previous.client_id = _current.client_id + AND _previous.sample_id = _current.sample_id + AND ( + _previous.normalized_channel = _current.normalized_channel + OR (_previous.normalized_channel IS NULL AND _current.normalized_channel IS NULL) ) WHERE _current.client_id IS NOT NULL diff --git a/sql_generators/search/templates/mobile_search_clients_daily.template.sql b/sql_generators/search/templates/mobile_search_clients_daily.template.sql index faebddc5a4..9f4e6a8443 100755 --- a/sql_generators/search/templates/mobile_search_clients_daily.template.sql +++ b/sql_generators/search/templates/mobile_search_clients_daily.template.sql @@ -161,8 +161,7 @@ fenix_metrics_with_locale AS ( fenix_metrics LEFT JOIN fenix_client_locales - USING - (client_id) + USING (client_id) ), glean_metrics AS ( SELECT diff --git a/sql_generators/serp_events/templates/desktop_query.sql b/sql_generators/serp_events/templates/desktop_query.sql index df7187528b..dd92d4ed89 100644 --- a/sql_generators/serp_events/templates/desktop_query.sql +++ b/sql_generators/serp_events/templates/desktop_query.sql @@ -41,8 +41,7 @@ serp_events AS ( raw_serp_events INNER JOIN filtered_impression_ids - USING - (impression_id) + USING (impression_id) ), impressions AS ( -- pull top-level fields from the impression event @@ -178,8 +177,7 @@ component_counts AS ( engagement_counts FULL JOIN ad_impression_counts - USING - (impression_id, component) + USING (impression_id, component) ) SELECT impression_id, @@ -243,20 +241,16 @@ FROM LEFT JOIN -- 1 row per impression_id with nonzero engagements engaged_sessions -USING - (impression_id) + USING (impression_id) LEFT JOIN -- 1 row per impression_id with nonzero ad impressions ad_sessions -USING - (impression_id) + USING (impression_id) LEFT JOIN -- 1 row per impression_id with an abandonment abandonments -USING - (impression_id) + USING (impression_id) LEFT JOIN -- expands to 1 row per impression_id per component that had either an engagement or an ad impression component_counts -USING - (impression_id) + USING (impression_id) diff --git a/tests/format_sql/scripting_example/expect.sql b/tests/format_sql/scripting_example/expect.sql index 714350ee44..42d3586eb6 100644 --- a/tests/format_sql/scripting_example/expect.sql +++ b/tests/format_sql/scripting_example/expect.sql @@ -18,8 +18,7 @@ BEGIN dataset.partitioned_table1 AS t1 JOIN dataset.partitioned_table2 AS t2 - ON - t1.id = t2.id + ON t1.id = t2.id WHERE t1.date = target_date AND t2.date = target_date; diff --git a/tests/util/test_mozfun_docs_functions.py b/tests/util/test_mozfun_docs_functions.py index 953d15eb43..f1dc64b32c 100644 --- a/tests/util/test_mozfun_docs_functions.py +++ b/tests/util/test_mozfun_docs_functions.py @@ -320,8 +320,7 @@ LANGUAGE js AS r\"\"\" UNNEST(buckets) AS key LEFT JOIN UNNEST(input_map) AS e - ON - key = e.key + ON key = e.key ORDER BY SAFE_CAST(key AS FLOAT64) )