Fork me on GitHub
Serafeim Papastefanos08:04:33

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?

Serafeim Papastefanos09:04:58

Yes it matters because it confuses people not familiar with the tool. It confused me

Serafeim Papastefanos09:04:20

I guess the correct query would be :from [:foo :f] ?


"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)

👍 1

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.

🙌 1

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).

❤️ 5