roam/daily/2022-06-06.org

39 lines
1.1 KiB
Org Mode
Raw Normal View History

2022-06-08 20:50:50 +00:00
:PROPERTIES:
:ID: 3728dbb0-bf51-4d82-a701-7dc63a35ceea
:END:
#+title: 2022-06-06
* [[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
#+end_src
#+RESULTS[ba37582203de3bc2f2032b77542766039971dbcd]:
| count |
|-------|
| 13 |
#+CAPTION: Find the next set of least affected accounts
#+NAME: 13-top-accounts
#+begin_src sql :results silent
SELECT account_id
FROM accounts
WHERE NOT normalized ORDER BY total
#+end_src
#+begin_src emacs-lisp :var accounts=13-top-accounts :results file :eval no-export
(let ((filename "~/git/normalize_account_tags/production/13-top-accounts"))
(with-temp-file filename
(insert (s-join "\n" (-map #'car accounts))))
filename)
#+end_src
#+RESULTS:
[[file:~/git/normalize_account_tags/production/13-top-accounts]]