This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-08-18
Channels
- # announcements (22)
- # asami (7)
- # babashka (43)
- # beginners (68)
- # biff (2)
- # calva (10)
- # clj-kondo (7)
- # cljdoc (29)
- # clojure (41)
- # clojure-austin (1)
- # clojure-brasil (2)
- # clojure-europe (25)
- # clojure-gamedev (3)
- # clojure-nl (2)
- # clojure-norway (9)
- # clojure-uk (31)
- # clojurescript (3)
- # community-development (7)
- # cursive (3)
- # data-science (4)
- # datomic (17)
- # emacs (30)
- # honeysql (10)
- # hyperfiddle (39)
- # introduce-yourself (1)
- # jobs-discuss (5)
- # kaocha (1)
- # lsp (11)
- # malli (12)
- # pathom (18)
- # pedestal (3)
- # proletarian (2)
- # quil (11)
- # rdf (46)
- # reitit (8)
- # releases (2)
- # shadow-cljs (34)
- # sql (3)
- # squint (10)
- # tools-deps (24)
- # xtdb (10)
I am looking for an example (if it is possible) where I can use a WHERE type IN ?
filter in SQL and give it a Clojure set (e.g. #{"type1" "type2"}
)
is this possible?
I seem to be getting:
; Can't infer the SQL type to use for an instance of clojure.lang.PersistentHashSet. Use setObject() with an explicit Types value to specify the type to use.
Some databases allow a Java array to be passed as an IN
parameter in JDBC but not all. Some require that you explicit "hint" the parameter type (see https://cljdoc.org/d/com.github.seancorfield/next.jdbc/1.3.883/api/next.jdbc.types for those hinting functions).
If you want a more flexible way to build your SQL that understands Clojure data structures, use HoneySQL which will construct the appropriate WHERE x IN (?,?,?)
from a Clojure sequence (I think it will still require you specify (seq your-set)
since it requires sequential data and a set is not sequential).
I am using Postgres... I'll look into the link at a later time when I'm not as tired. Thanks for the pointers 🙏