korma

Generating query clauses with korma and clojure

你说的曾经没有我的故事 提交于 2020-01-13 20:43:15
问题 I am trying to generate korma query conditions based on a map of columns and values that I pass into a function. I am finding that when an empty map is passed to korma's where: (select "things" (where conditions)) Generates queries with an empty WHERE which causes a SQL error: SELECT * FROM things WHERE () LIMIT 10 However using this form: (select "things" (if-not (empty? conditions) (where conditions))) Results in an error: "Wrong number of args (1) passed to: core$where" Is there an

Generating query clauses with korma and clojure

好久不见. 提交于 2020-01-13 20:40:43
问题 I am trying to generate korma query conditions based on a map of columns and values that I pass into a function. I am finding that when an empty map is passed to korma's where: (select "things" (where conditions)) Generates queries with an empty WHERE which causes a SQL error: SELECT * FROM things WHERE () LIMIT 10 However using this form: (select "things" (if-not (empty? conditions) (where conditions))) Results in an error: "Wrong number of args (1) passed to: core$where" Is there an

Trouble connecting to postgresql DB on Heroku with Korma (Clojure)

孤人 提交于 2020-01-12 07:28:14
问题 I am parsing the postgresql uri in my config settings on Heroku. But I cannot seem to get it working. Any help would be greatly appreciated, I'm probably missing something straight forward. Here is the code used. (def dev-db-info {:db "dbname" :user "username"}) (defn parse-db-uri [uri] (drop 1 (split uri #"://|:|@|/"))) (defn create-map-from-uri [uri] (let [parsed (parse-db-uri uri)] (zipmap [:user :password :host :port :db] parsed))) (defn db-info [] (if production? (create-map-from-uri

How to add JDBC-supported database (Informix) into korma

雨燕双飞 提交于 2019-12-11 21:17:49
问题 What steps do I need to take to allow my Informix JDBC driver to be a supported database in korma? Informix has a jdbc driver, and I have tested with the driver's demo Java programs. My connection parameters work. I've gone ahead and started a Clojure project, but I'm stuck on what to try even to get an error, so I can move forward from there, let alone connecting. My Informix JDBC driver 3.50 is in maven mvn install:install-file \ -DgroupId=com.informix \ -DartifactId=ifxjdbc \ -Dversion=3

Restricting select fields with Korma

孤街浪徒 提交于 2019-12-11 10:04:43
问题 I'm trying to restrict the columns returned from a select query to just one column, but Korma seems to just add the additional column to the default ones instead of using just this one: => (dry-run (select games (fields :white_id))) dry run :: SELECT "games"."stones", "games"."white_id", "games"."black_id", "games"."white_id" FROM "games" :: [] For reference: => (dry-run (select games )) dry run :: SELECT "games"."stones", "games"."white_id", "games"."black_id" FROM "games" :: [] What I'd

Generating query clauses with korma and clojure

岁酱吖の 提交于 2019-12-06 11:32:14
I am trying to generate korma query conditions based on a map of columns and values that I pass into a function. I am finding that when an empty map is passed to korma's where: (select "things" (where conditions)) Generates queries with an empty WHERE which causes a SQL error: SELECT * FROM things WHERE () LIMIT 10 However using this form: (select "things" (if-not (empty? conditions) (where conditions))) Results in an error: "Wrong number of args (1) passed to: core$where" Is there an idiomatic way of handling dynamic clauses in korma? UPDATE The following works, but is pretty clumsy (note the