This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-07-14
Channels
- # aleph (4)
- # announcements (1)
- # beginners (40)
- # calva (6)
- # cider (10)
- # clara (5)
- # cljdoc (24)
- # cljs-dev (2)
- # clojure (24)
- # clojure-italy (4)
- # clojure-uk (5)
- # clojurescript (13)
- # community-development (5)
- # core-async (7)
- # data-science (9)
- # datomic (2)
- # duct (12)
- # emacs (3)
- # events (1)
- # figwheel-main (2)
- # fulcro (2)
- # malli (1)
- # off-topic (1)
- # parinfer (1)
- # precept (6)
- # re-frame (27)
- # shadow-cljs (5)
- # sql (6)
- # unrepl (2)
Facing some trouble tying to use next.jdbc
with Hikari datasource
(require '[next.jdbc :as nj])
(nj/execute! datasource ["
create table address (
id int auto_increment primary key,
name varchar(32),
email varchar(255)
)"])
^This blurts out the error listed below.
Execution error (PSQLException) at org.postgresql.core.v3.QueryExecutorImpl/receiveErrorResponse (QueryExecutorImpl.java:2440).
ERROR: syntax error at or near "auto_increment"
Position: 34
ReadableColumn
and SettableParameter
protocols.So,
(nj/execute! datasource ["
create table address (
name varchar(32),
email varchar(255)
)"])
=> [#:next.jdbc{:update-count 0}]
(nj-sql/insert! datasource :address {:name "Shubham"
:email ""})
=> #:address{:name "Shubham", :email ""}
(nj-sql/query datasource ["SELECT * FROM address where name = ?" "Shubham"])
=> [#:address{:name "Shubham", :email ""}]
^this works just fine. So, that removes the question of not using datasource correctly.Likewise, if I have a uuid
column in my table, it results into a similar error
Do I need to extend any protocol?
Ah I see the extension point is https://github.com/seancorfield/next-jdbc/blob/master/doc/migration-from-clojure-java-jdbc.md#further-minor-differences
SettableParameter
now