Fork me on GitHub
#sql
<
2019-10-22
>
murtaza5209:10:06

@seancorfield that works perfectly, thanks.

murtaza5211:10:54

Just nitpicking here, I have a query - (helpers/select :id [(sql/call :ST_AsText :location) :sample/location]) which returns - {:sample/id 1, :location "POINT(32.621431 0.291065)"} Is it possible to either return both as namespaced keys or neither as namespaced keys, its just that the destructuring will be little more pretty. Currently this is what I am doing, which is little jarring -

(let [{:keys [location] :cabs/keys [id]} result]
    [location id])

dharrigan11:10:48

something like this would work: (jdbc/execute-one! @datasource sql {:builder-fn rs/as-unqualified-lower-maps})]

dharrigan11:10:56

use the builder-fn

seancorfield15:10:49

@murtaza52 next.jdbc can only qualify column names where the JDBC driver can provide .getTableName -- which is empty for computed columns.

pablore21:10:46

Hi, I’m migrating a small project to next.jdbc and I noticed that query now returns a namespaced hashmap. How do I un-namespace the result?

seancorfield21:10:36

That whole page is probably worth reading @pablore

seancorfield21:10:33

(I'd say the whole docs are worth reading if you're just starting to use next.jdbc -- it should answer all your questions, including DB-specific tips & tricks in the friendly SQL functions section)

seancorfield21:10:18

I'd also strongly recommend using the primary API (`next.jdbc`) where possible and only using next.jdbc.sql as a migration aid for legacy code.