|
| 1 | +WITH table_counts AS ( |
| 2 | + SELECT |
| 3 | + 'account_customers' AS table_name, |
| 4 | + COUNT(*) AS total_rows |
| 5 | + FROM |
| 6 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_account_customers_v1` |
| 7 | + UNION ALL |
| 8 | + SELECT |
| 9 | + 'account_groups' AS table_name, |
| 10 | + COUNT(*) AS total_rows |
| 11 | + FROM |
| 12 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_account_groups_v1` |
| 13 | + UNION ALL |
| 14 | + SELECT |
| 15 | + 'account_reset_tokens' AS table_name, |
| 16 | + COUNT(*) AS total_rows |
| 17 | + FROM |
| 18 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_account_reset_tokens_v1` |
| 19 | + UNION ALL |
| 20 | + SELECT |
| 21 | + 'accounts' AS table_name, |
| 22 | + COUNT(*) AS total_rows |
| 23 | + FROM |
| 24 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_accounts_v1` |
| 25 | + UNION ALL |
| 26 | + SELECT |
| 27 | + 'carts' AS table_name, |
| 28 | + COUNT(*) AS total_rows |
| 29 | + FROM |
| 30 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_carts_v1` |
| 31 | + UNION ALL |
| 32 | + SELECT |
| 33 | + 'device_commands' AS table_name, |
| 34 | + COUNT(*) AS total_rows |
| 35 | + FROM |
| 36 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_device_commands_v1` |
| 37 | + UNION ALL |
| 38 | + SELECT |
| 39 | + 'devices' AS table_name, |
| 40 | + COUNT(*) AS total_rows |
| 41 | + FROM |
| 42 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_devices_v1` |
| 43 | + UNION ALL |
| 44 | + SELECT |
| 45 | + 'email_bounces' AS table_name, |
| 46 | + COUNT(*) AS total_rows |
| 47 | + FROM |
| 48 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_email_bounces_v1` |
| 49 | + UNION ALL |
| 50 | + SELECT |
| 51 | + 'emails' AS table_name, |
| 52 | + COUNT(*) AS total_rows |
| 53 | + FROM |
| 54 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_emails_v1` |
| 55 | + UNION ALL |
| 56 | + SELECT |
| 57 | + 'linked_accounts' AS table_name, |
| 58 | + COUNT(*) AS total_rows |
| 59 | + FROM |
| 60 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_linked_accounts_v1` |
| 61 | + UNION ALL |
| 62 | + SELECT |
| 63 | + 'oauth_codes' AS table_name, |
| 64 | + COUNT(*) AS total_rows |
| 65 | + FROM |
| 66 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_oauth_codes_v1` |
| 67 | + UNION ALL |
| 68 | + SELECT |
| 69 | + 'oauth_refresh_tokens' AS table_name, |
| 70 | + COUNT(*) AS total_rows |
| 71 | + FROM |
| 72 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_oauth_refresh_tokens_v1` |
| 73 | + UNION ALL |
| 74 | + SELECT |
| 75 | + 'oauth_tokens' AS table_name, |
| 76 | + COUNT(*) AS total_rows |
| 77 | + FROM |
| 78 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_oauth_tokens_v1` |
| 79 | + UNION ALL |
| 80 | + SELECT |
| 81 | + 'password_change_tokens' AS table_name, |
| 82 | + COUNT(*) AS total_rows |
| 83 | + FROM |
| 84 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_password_change_tokens_v1` |
| 85 | + UNION ALL |
| 86 | + SELECT |
| 87 | + 'password_forgot_tokens' AS table_name, |
| 88 | + COUNT(*) AS total_rows |
| 89 | + FROM |
| 90 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_password_forgot_tokens_v1` |
| 91 | + UNION ALL |
| 92 | + SELECT |
| 93 | + 'paypal_customers' AS table_name, |
| 94 | + COUNT(*) AS total_rows |
| 95 | + FROM |
| 96 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_paypal_customers_v1` |
| 97 | + UNION ALL |
| 98 | + SELECT |
| 99 | + 'recovery_codes' AS table_name, |
| 100 | + COUNT(*) AS total_rows |
| 101 | + FROM |
| 102 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_recovery_codes_v1` |
| 103 | + UNION ALL |
| 104 | + SELECT |
| 105 | + 'security_events' AS table_name, |
| 106 | + COUNT(*) AS total_rows |
| 107 | + FROM |
| 108 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_security_events_v1` |
| 109 | + UNION ALL |
| 110 | + SELECT |
| 111 | + 'sent_emails' AS table_name, |
| 112 | + COUNT(*) AS total_rows |
| 113 | + FROM |
| 114 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_sent_emails_v1` |
| 115 | + UNION ALL |
| 116 | + SELECT |
| 117 | + 'session_tokens' AS table_name, |
| 118 | + COUNT(*) AS total_rows |
| 119 | + FROM |
| 120 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_session_tokens_v1` |
| 121 | + UNION ALL |
| 122 | + SELECT |
| 123 | + 'signin_codes' AS table_name, |
| 124 | + COUNT(*) AS total_rows |
| 125 | + FROM |
| 126 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_signin_codes_v1` |
| 127 | + UNION ALL |
| 128 | + SELECT |
| 129 | + 'totp' AS table_name, |
| 130 | + COUNT(*) AS total_rows |
| 131 | + FROM |
| 132 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_totp_v1` |
| 133 | + UNION ALL |
| 134 | + SELECT |
| 135 | + 'unblock_codes' AS table_name, |
| 136 | + COUNT(*) AS total_rows |
| 137 | + FROM |
| 138 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_unblock_codes_v1` |
| 139 | + UNION ALL |
| 140 | + SELECT |
| 141 | + 'unverified_tokens' AS table_name, |
| 142 | + COUNT(*) AS total_rows |
| 143 | + FROM |
| 144 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_unverified_tokens_v1` |
| 145 | + UNION ALL |
| 146 | + SELECT |
| 147 | + 'verification_reminders' AS table_name, |
| 148 | + COUNT(*) AS total_rows |
| 149 | + FROM |
| 150 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_verification_reminders_v1` |
| 151 | + UNION ALL |
| 152 | + ( |
| 153 | + SELECT |
| 154 | + "accounts_with_secondary_emails" AS table_name, |
| 155 | + COUNT(DISTINCT accounts.uid) AS total_rows |
| 156 | + FROM |
| 157 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_accounts_v1` accounts |
| 158 | + JOIN |
| 159 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_emails_v1` emails |
| 160 | + ON accounts.uid = emails.uid |
| 161 | + WHERE |
| 162 | + emails.isPrimary = FALSE |
| 163 | + ) |
| 164 | + UNION ALL |
| 165 | + ( |
| 166 | + SELECT |
| 167 | + "accounts_with_unverified_emails" AS table_name, |
| 168 | + COUNT(DISTINCT accounts.uid) AS total_rows |
| 169 | + FROM |
| 170 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_accounts_v1` accounts |
| 171 | + JOIN |
| 172 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_emails_v1` emails |
| 173 | + ON accounts.uid = emails.uid |
| 174 | + WHERE |
| 175 | + emails.isVerified = FALSE |
| 176 | + ) |
| 177 | + UNION ALL |
| 178 | + ( |
| 179 | + SELECT |
| 180 | + "accounts_linked_to_google" AS table_name, |
| 181 | + COUNT(uid) AS total_rows |
| 182 | + FROM |
| 183 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_linked_accounts_v1` |
| 184 | + WHERE |
| 185 | + providerId = 1 -- see LinkedAccountProviderIds at https://github.com/mozilla/fxa/blob/main/packages/fxa-settings/src/lib/types.ts |
| 186 | + ) |
| 187 | + UNION ALL |
| 188 | + ( |
| 189 | + SELECT |
| 190 | + "accounts_linked_to_apple" AS table_name, |
| 191 | + COUNT(uid) AS total_rows |
| 192 | + FROM |
| 193 | + `moz-fx-data-shared-prod.accounts_db_external.fxa_linked_accounts_v1` |
| 194 | + WHERE |
| 195 | + providerId = 2 -- see LinkedAccountProviderIds at https://github.com/mozilla/fxa/blob/main/packages/fxa-settings/src/lib/types.ts |
| 196 | + ) |
| 197 | +) |
| 198 | +SELECT |
| 199 | + @submission_date AS date, |
| 200 | + table_name, |
| 201 | + total_rows |
| 202 | +FROM |
| 203 | + table_counts |
0 commit comments