69 lines
2 KiB
Org Mode
69 lines
2 KiB
Org Mode
:PROPERTIES:
|
|
:ID: 3c57d654-309e-4297-a8f6-e14809e512db
|
|
:END:
|
|
#+title: 2022-05-24
|
|
|
|
* [[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:
|
|
** Completing yesterday's set
|
|
#+CAPTION: Find the next set of least affected accounts
|
|
#+begin_src sql
|
|
SELECT COUNT(*)
|
|
FROM accounts
|
|
WHERE NOT normalized AND total <= 50
|
|
#+end_src
|
|
|
|
#+RESULTS[3b91f19494773258001c8f81134f9b930f7a5898]:
|
|
| count |
|
|
|-------|
|
|
| 385 |
|
|
|
|
#+CAPTION: Find the next set of least affected accounts
|
|
#+NAME: 04-less-than-equal-to-fifty
|
|
#+begin_src sql :results silent
|
|
SELECT account_id
|
|
FROM accounts
|
|
WHERE NOT normalized AND total <= 50
|
|
#+end_src
|
|
|
|
#+begin_src emacs-lisp :var accounts=04-less-than-equal-to-fifty :results file :eval no-export
|
|
(let ((filename "~/git/normalize_account_tags/production/04-less-than-equal-to-fifty"))
|
|
(with-temp-file filename
|
|
(insert (s-join "\n" (-map #'car accounts))))
|
|
filename)
|
|
#+end_src
|
|
|
|
#+RESULTS:
|
|
[[file:~/git/normalize_account_tags/production/04-less-than-equal-to-fifty]]
|
|
** Next set
|
|
#+CAPTION: Find the next set of least affected accounts
|
|
#+begin_src sql
|
|
SELECT COUNT(*)
|
|
FROM accounts
|
|
WHERE NOT normalized AND total <= 100
|
|
#+end_src
|
|
|
|
#+RESULTS[ef2cfc019cfa507c8e70a11e2c51488945751704]:
|
|
| count |
|
|
|-------|
|
|
| 306 |
|
|
|
|
#+CAPTION: Find the next set of least affected accounts
|
|
#+NAME: 05-less-than-equal-to-one-hundred
|
|
#+begin_src sql :results silent
|
|
SELECT account_id
|
|
FROM accounts
|
|
WHERE NOT normalized AND total <= 100
|
|
#+end_src
|
|
|
|
#+begin_src emacs-lisp :var accounts=05-less-than-equal-to-one-hundred :results file :eval no-export
|
|
(let ((filename "~/git/normalize_account_tags/production/05-less-than-equal-to-one-hundred"))
|
|
(with-temp-file filename
|
|
(insert (s-join "\n" (-map #'car accounts))))
|
|
filename)
|
|
#+end_src
|
|
|
|
#+RESULTS:
|
|
[[file:~/git/normalize_account_tags/production/05-less-than-equal-to-one-hundred]]
|