This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-09-22
Channels
- # announcements (2)
- # asami (123)
- # aws (17)
- # babashka (77)
- # babashka-sci-dev (23)
- # beginners (48)
- # biff (6)
- # calva (35)
- # cider (16)
- # clj-on-windows (1)
- # clj-yaml (19)
- # clojure (36)
- # clojure-europe (78)
- # clojure-nl (5)
- # clojure-norway (8)
- # clojure-poland (3)
- # clojure-uk (16)
- # clojurescript (17)
- # cursive (6)
- # datahike (3)
- # datalevin (26)
- # duct (7)
- # emacs (41)
- # events (2)
- # fulcro (7)
- # graphql (5)
- # honeysql (13)
- # juxt (3)
- # kaocha (7)
- # lsp (5)
- # malli (12)
- # off-topic (14)
- # pathom (3)
- # portal (1)
- # rdf (9)
- # reitit (3)
- # remote-jobs (2)
- # shadow-cljs (37)
- # spacemacs (5)
- # tools-build (1)
- # tools-deps (20)
- # xtdb (2)
Am I missing something about how to use the ->> json operator for postgresql? I've tried to no avail in the select clause (select ...)
[:->> :report_summary :clicks]
and
[:->> :report_summary "clicks"]
Did you require the honey.sql.pg-ops
namespace?
seanc@Sean-win-11-laptop:~/oss/honeysql$ clj
Clojure 1.9.0
user=> (require '[honey.sql :as sql] '[honey.sql.helpers :refer :all] '[honey.sql.pg-ops :as pg] :reload)
...
nil
user=> (-> (select :*) (from :table) (where [:= :a [:->> :report_summary :clicks]]) (sql/format))
["SELECT * FROM table WHERE a = (report_summary ->> clicks)"]
user=>
See https://cljdoc.org/d/com.github.seancorfield/honeysql/2.3.928/doc/getting-started/postgresql-support#operators-with---and-Yes. I'm getting "illegal syntax in select expression " Which goes away when I remove the line
Show more of your code, please. As you can see above, it works.
Running gives me the same error for the select expression.
(require '[honey.sql :as sql] '[honey.sql.helpers :refer :all] '[honey.sql.pg-ops :as pg] :reload)
(-> {}
(select
[:->> :report_summary :clicks])
(from :campaigns)
(sql/format))
Your syntax is wrong. Read the docs around SELECT
and expressions to get the nesting correct.
Sorry for shortness. Very busy right now.
user=> (-> (select :col1 [:col2 :alias] [[:->> :report_summary :clicks]]) (from :table) (sql/format))
["SELECT col1, col2 AS alias, report_summary ->> clicks FROM table"]
user=>