Fork me on GitHub

Has anyone experienced postgres trying to use your local users name even when you provide the proper username for a database in the map?

(def db-spec {:dbtype   "postgresql"
              :dbname   "monarch"
              :username "vega"
              :password "spiderdeus"})

(def datasource (jdbc/get-datasource db-spec))


It's :user, not :username.


You only need :username when you're using HikariCP.

👍 1

Ha, ok that makes sense. Ironically I was in between setting hikaricp up then I decided "no, let me do this manually". Gotcha....


It's a pain that HikariCP alone requires :username 😞


Well...simple enough. I'll be using it later tonight...but now I know there's a difference.


Thank you!


I'm vaguely tempted to treat :username as an alias for :user for the non-HikariCP case at some point.

👍 4

I'm not sure I'm phrasing this correctly, but how would I wrap next.jdbc/plan with an xform, returning a lazy sequence of transformed records? something like:

(defn processed-records
  ( ... something wrapped around this to create a lazy-seq:
    (jdbc/plan (jdbc/get-datasource jdbc-url)
               ["select name, age from some_table"]
... such that the function "pre-processes" each record in the (lazy) sequence? I can require that users of processed-records do the processing as part of an xform in into or reduce, but I'd like to be able to run something like:
(into [] (processed-records jdbc-url))
and get the records dumped into a vector -- maybe part of the pre-processing is to convert each row into a string formatted as "[name=larry age=33]" without having to apply a transform outside processed-records . does that make sense?