74 lines
2.3 KiB
Org Mode
74 lines
2.3 KiB
Org Mode
|
:PROPERTIES:
|
||
|
:ID: f5d02f07-3585-49b1-a2e1-5867edf94680
|
||
|
:END:
|
||
|
#+title: 2022-05-26
|
||
|
* [[id:d06d3ab4-c2d0-47c3-aae1-4395567fc3d2][Normalizing tags]] in production
|
||
|
:PROPERTIES:
|
||
|
:header-args:sql: :engine postgresql :cmdline "-U postgres postgres" :dir /docker:postgres: :exports both :cache yes :eval no-export
|
||
|
:END:
|
||
|
** First pass
|
||
|
|
||
|
#+CAPTION: Find the next set of least affected accounts
|
||
|
#+begin_src sql
|
||
|
SELECT COUNT(*)
|
||
|
FROM accounts
|
||
|
WHERE NOT normalized AND total <= 500
|
||
|
#+end_src
|
||
|
|
||
|
#+RESULTS[4e2afc6030287036e6f8e35197d2286a91d155b1]:
|
||
|
| count |
|
||
|
|-------|
|
||
|
| 371 |
|
||
|
|
||
|
#+CAPTION: Find the next set of least affected accounts
|
||
|
#+NAME: 07-less-than-equal-to-five-hundred
|
||
|
#+begin_src sql :results silent
|
||
|
SELECT account_id
|
||
|
FROM accounts
|
||
|
WHERE NOT normalized AND total <= 500
|
||
|
#+end_src
|
||
|
|
||
|
#+begin_src emacs-lisp :var accounts=07-less-than-equal-to-five-hundred :results file :eval no-export
|
||
|
(let ((filename "~/git/normalize_account_tags/production/07-less-than-equal-to-five-hundred"))
|
||
|
(with-temp-file filename
|
||
|
(insert (s-join "\n" (-map #'car accounts))))
|
||
|
filename)
|
||
|
#+end_src
|
||
|
|
||
|
#+RESULTS:
|
||
|
[[file:~/git/normalize_account_tags/production/07-less-than-equal-to-five-hundred]]
|
||
|
** Encountered mapping errors
|
||
|
There were a significant number of 503 errors being raised by mapping that
|
||
|
affected the run. Only accounts that were normalized successfully were marked as
|
||
|
complete. Mapping was restarted in production, clearing up the errors.
|
||
|
** Resuming
|
||
|
#+CAPTION: Find the next set of least affected accounts
|
||
|
#+begin_src sql
|
||
|
SELECT COUNT(*)
|
||
|
FROM accounts
|
||
|
WHERE NOT normalized AND total <= 500
|
||
|
#+end_src
|
||
|
|
||
|
#+RESULTS[4e2afc6030287036e6f8e35197d2286a91d155b1]:
|
||
|
| count |
|
||
|
|-------|
|
||
|
| 152 |
|
||
|
|
||
|
#+CAPTION: Find the next set of least affected accounts
|
||
|
#+NAME: 08-less-than-equal-to-five-hundred
|
||
|
#+begin_src sql :results silent
|
||
|
SELECT account_id
|
||
|
FROM accounts
|
||
|
WHERE NOT normalized AND total <= 500
|
||
|
#+end_src
|
||
|
|
||
|
#+begin_src emacs-lisp :var accounts=08-less-than-equal-to-five-hundred :results file :eval no-export
|
||
|
(let ((filename "~/git/normalize_account_tags/production/08-less-than-equal-to-five-hundred"))
|
||
|
(with-temp-file filename
|
||
|
(insert (s-join "\n" (-map #'car accounts))))
|
||
|
filename)
|
||
|
#+end_src
|
||
|
|
||
|
#+RESULTS:
|
||
|
[[file:~/git/normalize_account_tags/production/08-less-than-equal-to-five-hundred]]
|