This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-10-18
Channels
- # announcements (8)
- # aws (5)
- # babashka (69)
- # beginners (37)
- # calva (222)
- # cider (10)
- # clj-commons (8)
- # clj-kondo (69)
- # cljdoc (5)
- # clojure (62)
- # clojure-dev (23)
- # clojure-europe (37)
- # clojure-italy (2)
- # clojure-nl (6)
- # clojure-sg (6)
- # clojure-uk (5)
- # clojurescript (25)
- # clojureverse-ops (12)
- # conjure (1)
- # cursive (1)
- # fulcro (9)
- # gorilla (1)
- # graalvm (6)
- # graphql (1)
- # gratitude (1)
- # honeysql (7)
- # introduce-yourself (4)
- # jobs (1)
- # kaocha (9)
- # keyboards (4)
- # leiningen (8)
- # lsp (21)
- # malli (9)
- # music (3)
- # nextjournal (17)
- # nrepl (6)
- # off-topic (10)
- # pathom (12)
- # portal (25)
- # reagent (8)
- # releases (1)
- # specter (1)
- # xtdb (1)
Hi there! Is it possible to somehow keep the aliases on HoneySQL as qualified keywords?
I'm querying a SQL database and I want to make aliases like SUM("person.age") as "people/age"
. Is it possible for HoneySQL to keep aliases as qualified keywords? Something like {:select [[[:sum :person.age] :people/age]]}
, but keeping the alias as-is (currently it is converting to "people"."age"
)
@mauricio.szabo Which version of HoneySQL? I think this differs between 1.x and 2.x?
I'm using the latest version (2.1.818).
I remember that I was able to make it work with 1.x a long time ago, but it was even a different Clojure version so I'm not sure what changed (or even if something changed). I somehow was able to fix by monkey-patching honey/format-entity
, but I don't think that's a great solution 😄
Could you create an issue on GH with a small repro case of what you need? There may be a way to make it work but I'll need to spend some time experimenting.
dev=> (sql/format {:select [[[:sum :person.age] "people/age"]]})
["SELECT SUM(person.age) AS \"people/age\""]
In general, using strings for aliases leaves them as-is. Not sure if that helps you?Oh, and it already quotes! Ok, that works for me 🙂
It is mentioned in the docs but it's probably not very obvious, since it's in a big paragraph about naming and quoting strategies...