The following minimal example fails with an error Query didn't match expected structure
:
(def pull-pattern
[:xt/id
:name
:created-at])
(xt/q (xt/db node)
'{:find [(pull ?e pattern)]
:in [?name pattern]
:where [[?e :name ?name]]}
"example name" pull-pattern)
This one works normally:
(xt/q (xt/db node)
'{:find [(pull ?e [:xt/id :name :created-at])]
:in [?name]
:where [[?e :name ?name]]}
"example name")
I’m very new to XTDB and running it with the following configuration:
documet-store: AWS S3
tx-log: JDBC on AWS RDS - Aurora
index-store: RocksDB
As per @refset …
Not currently, unfortunately, so you will have to construct the query dynamically:
(xt/q (xt/db node)
{:find [(list 'pull '?e pull-pattern)]
:in '[?name]
:where '[[?e :name ?name]]}
"example name")
you could also use the pull
API as a separate step, or even create a custom function that does the work inside a subquery (e.g. something a little simpler than this lazy-authz-subquery-with-limit · GitHub …but hopefully it gives some idea)
A solution could be as following, however as @refset mentioned on Slack, this could have different performance characteristics based on the configuration etc.
(->> (xt/q db '{:find [?e]
:in [?name]
:where [[?e :name ?name]]}
"example name")
(map first)
(xt/pull-many db pull-pattern))