roam/daily/2022-05-18.org
2022-05-27 17:35:02 -04:00

1.8 KiB

2022-05-18

Normalizing tags in production

  DROP TABLE IF EXISTS accounts;
  CREATE TABLE accounts AS
  SELECT account_id, COUNT(tag) AS total, FALSE AS normalized
  FROM invalid_tags
  GROUP BY account_id;
Create a table to track normalized accounts
DROP TABLE
SELECT 3220
  SELECT COUNT(*)
  FROM accounts
  WHERE NOT normalized AND total < 100
Find the least affected accounts first
count
2241
  SELECT account_id
  FROM accounts
  WHERE NOT normalized AND total = 1
  (let ((filename "~/git/normalize_account_tags/production/01-single-tag-accounts"))
    (with-temp-file filename
      (insert (s-join "\n" (-map #'first accounts))))
    filename)

/correlr/roam/src/commit/3b2f25715aacea628a65677bcea865ae4db12670/daily/~/git/normalize_account_tags/production/01-single-tag-accounts

########################################
### COMPLETED 473/473 (0 remaining)
### ELAPSED: 02:21:49
### ESTIMATED REMAINING: 00:00:00
########################################
  UPDATE accounts
  SET normalized = TRUE
  WHERE NOT normalized AND total = 1
UPDATE 474