walkable-server / walkable

A Clojure(script) SQL library for building APIs: Datomic® (GraphQL-ish) pull syntax, data driven configuration, dynamic filtering with relations in mind
https://walkable.gitlab.io/
Eclipse Public License 2.0
444 stars 15 forks source link

Wildcard queries? #161

Closed schmee closed 4 years ago

schmee commented 4 years ago

Does Walkable support wildcards (SELECT * FROM...)?

This works for me:

(let [my-query `[{[:foo.user/by-id 1] [:foo.user/id :foo.user/email-address]}]
      my-db ... 
      my-run-query jdbc/query]
  (sync-parser {::sqb/sql-db     my-db
                ::sqb/run-query  my-run-query
                ::sqb/floor-plan compiled-floor-plan}
               my-query)))

user=>
{[:foo.user/by-id 1] #:foo.user{:email-address "foo@bar.com" :id 1}}

This doesn't:

(let [my-query `[{[:foo.user/by-id 1] [*]}]
      my-db ... 
      my-run-query jdbc/query]
  (sync-parser {::sqb/sql-db     my-db
                ::sqb/run-query  my-run-query
                ::sqb/floor-plan compiled-floor-plan}
               my-query)))

user=>
Execution error (NullPointerException) at walkable.sql-query-builder/process-children*$fn (sql_query_builder.cljc:30).
null
myguidingstar commented 4 years ago

No, Walkable doesn't support that as of now

schmee commented 4 years ago

Ahh, I see! The docs gave me the impression that it was supported, maybe that could be clarified? (https://walkable.gitlab.io/query_language.html#2-joins):

image