Search code examples
sqlemacsorg-mode

Hide org src dbpassword header to other place


I am learning through postgres with "Practical SQL"

#+begin_src sql :engine postgresql :dbuser org  :dbpassword 1618 :database analysis
select * from teachers
order by hire_date desc
limit 3;
#+end_src

#+RESULTS:
| id | first_name | last_name | school              |  hire_date | salary |
|----+------------+-----------+---------------------+------------+--------|
|  1 | Janet      | Smith     | F.D. Roosevelt HS   | 2011-10-30 |  36200 |
|  4 | Samantha   | Bush      | Myers Middle School | 2011-10-30 |  36200 |
|  6 | Kathleen   | Roush     | F.D. Roosevelt HS   | 2010-10-22 |  38500 |

Reference to the header of :dbpassword,

Is it possible to save it other places like the header of files so as to avoid exposing it as header in src?


Solution

  • You should be able to use :dbpassword (read-passwd "Password: "). The (...) is just ordinary Emacs Lisp code, you're free to use others.