This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-04-22
Channels
- # announcements (8)
- # babashka (4)
- # beginners (164)
- # calva (17)
- # cider (30)
- # cljdoc (4)
- # cljs-dev (6)
- # clojure (103)
- # clojure-europe (63)
- # clojure-nl (1)
- # clojure-norway (1)
- # clojure-portugal (1)
- # clojure-uk (3)
- # clojured (10)
- # clojuredesign-podcast (2)
- # clojurescript (16)
- # conjure (2)
- # core-async (9)
- # cursive (26)
- # datalevin (4)
- # datomic (156)
- # gratitude (1)
- # holy-lambda (8)
- # honeysql (9)
- # hoplon (6)
- # off-topic (55)
- # polylith (14)
- # portal (21)
- # reagent (5)
- # reitit (16)
- # releases (3)
- # shadow-cljs (87)
- # spacemacs (3)
- # tools-deps (25)
- # xtdb (9)
hey friends! i'm reading the readme of the project and see this example code
(def sqlmap {:select [:a :b :c]
:from [:foo]
:where [:= :f.a "baz"]})
I can't understand what's :f
in the where clause. is this a typo ?It translates to ["SELECT a, b, c FROM foo WHERE f.a = ?" "baz"]
f
could be an alias of foo
but the purpose of the example is to showcase the syntax. Does it really matter whether the query itself is correct or not?
Yes it matters because it confuses people not familiar with the tool. It confused me
I guess the correct query would be :from [:foo :f] ?
Cool thank you
"correct" as in standalone
f
could be the name/alias of another table that is defined in an earlier part of the query (in which case the original query isn't necessarily incorrect)
Mostly that stuff came from tests originally where the SQL didn't have to be valid but I can clean up the examples. Feel free to create a GitHub issue to remind me.
I've updated the README to use foo.a
instead of f.a
to avoid that confusion. That will get into cljdoc in the next release (I updated the README after making the 2.2.891 release, sorry).