This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-08-03
Channels
- # aleph (8)
- # announcements (3)
- # architecture (47)
- # babashka (22)
- # beginners (22)
- # chlorine-clover (2)
- # cider (15)
- # clj-yaml (6)
- # cljs-dev (3)
- # clojure (76)
- # clojure-austin (2)
- # clojure-europe (16)
- # clojure-france (10)
- # clojure-gamedev (11)
- # clojure-norway (28)
- # clojure-sweden (4)
- # clojurescript (32)
- # conjure (1)
- # datahike (2)
- # datomic (6)
- # events (9)
- # graalvm (8)
- # gratitude (5)
- # honeysql (8)
- # humbleui (2)
- # hyperfiddle (37)
- # jobs (1)
- # polylith (4)
- # re-frame (14)
- # releases (2)
- # rum (9)
- # sci (9)
- # scittle (8)
- # shadow-cljs (9)
- # spacemacs (4)
- # sql (10)
- # xtdb (24)
Is there a way to reference a quoted alias without :raw
?
I want to use quoted alias in ORDER BY clause
SELECT column_name AS "some-alias" FROM b ORDER BY "some-alias" ASC
I would like to avoid using :raw
because the alias value comes from 3d party
(honey.sql/format {:select [[:column-name "some-alias"]]
:from :b
:order-by [[[:raw "\"some-alias\""]]]})
Quoting everything doesn't work because it doesn't convert kebab column names to underscores
(honey.sql/format {:select [[:column-name "some-alias"]]
:from :b
:order-by [:some-alias]}
{:quoted true})
SELECT "column-name" AS "some-alias" FROM "b" ORDER BY "some-alias" ASC
And quoted-snake
corrupts dashes in aliases
(honey.sql/format {:select [[:column-name "some-alias"]]
:from :b
:order-by [:some-alias]}
{:quoted-snake true})
SELECT column_name AS "some_alias" FROM b ORDER BY some_alias ASC
Oh, huh. There's stuff like :'x
but apparently it works only when it's in a function-calling context.
@U076FM90B Feel free to create an issue on GitHub for me to look at. AS
aliases have special treatment so maybe I'll need to add special syntax like [:alias "some-alias"]
so you can get that treatment elsewhere...
@U04V70XH6 Wouldn't it make more sense to support :'x
everywhere? A breaking change, I suppose, but maybe could be put behind an opt-in flag?
That's something I'll take a look at as part of this issue.
I think the behavior of :'x
may already be context-dependent but I'd have to refresh my memory...