:PROPERTIES: :ID: ada428ac-6937-4790-83a8-d67852a9de33 :END: #+title: 2022-05-27 * [[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: #+CAPTION: Find the next set of least affected accounts #+begin_src sql SELECT COUNT(*) FROM accounts WHERE NOT normalized AND total <= 1000 #+end_src #+RESULTS[efaf69d6d049d7a136ec43b141a98833c0f2931e]: | count | |-------| | 301 | #+CAPTION: Find the next set of least affected accounts #+NAME: 09-less-than-equal-to-one-thousand #+begin_src sql :results silent SELECT account_id FROM accounts WHERE NOT normalized AND total <= 1000 #+end_src #+begin_src emacs-lisp :var accounts=09-less-than-equal-to-one-thousand :results file :eval no-export (let ((filename "~/git/normalize_account_tags/production/09-less-than-equal-to-one-thousand")) (with-temp-file filename (insert (s-join "\n" (-map #'car accounts)))) filename) #+end_src #+RESULTS: [[file:~/git/normalize_account_tags/production/09-less-than-equal-to-one-thousand]]