Pull enhancements #230

Open
opened 2020-08-06 16:57:02 +00:00 by gburd · 0 comments
gburd commented 2020-08-06 16:57:02 +00:00 (Migrated from github.com)
  • Implement pulling :db/id, which means we can avoid using rel results in some cases. Rather than [:find [?person (pull ?person [:person/name])] …] we can do [:find [(pull ?person [:db/id :as :person/id :person/name]) ...] …] and handle the returned maps.

  • Implement aliases.

  • Allow for non-namespaced keywords in StructuredMap. This would allow :as :id instead of :as :something/id.

  • Consider whether it's better to return TypedValue::Ref(12345) or {:db/id 12345} — the former is an advantage of our type system, and simplifies extraction of values, but the latter might be more regular when considering fetching more values, and is the way Datomic represents an entity in pull.

  • Single-step pull execution. A query like

    [:find (pull ?x [:a/b :c/d]) :where ]
    

    can be executed in a single SQL query. The in-progress implementation will take two.

  • Full prepared statement support. This probably looks like inserting the results of the prepared query into a temporary table, and running the pull from there. That makes both queries fixed and allows us to prepare both the 'front' and 'back' of the query.

- [x] Implement pulling `:db/id`, which means we can avoid using rel results in some cases. Rather than `[:find [?person (pull ?person [:person/name])] …]` we can do `[:find [(pull ?person [:db/id :as :person/id :person/name]) ...] …]` and handle the returned maps. - [x] Implement aliases. - [x] Allow for non-namespaced keywords in `StructuredMap`. This would allow `:as :id` instead of `:as :something/id`. - [x] Consider whether it's better to return `TypedValue::Ref(12345)` or `{:db/id 12345}` — the former is an advantage of our type system, and simplifies extraction of values, but the latter might be more regular when considering fetching more values, and is the way Datomic represents an entity in pull. - [ ] Single-step pull execution. A query like ```edn [:find (pull ?x [:a/b :c/d]) :where …] ```` can be executed in a single SQL query. The in-progress implementation will take two. - [ ] Full prepared statement support. This probably looks like inserting the results of the prepared query into a temporary table, and running the pull from there. That makes both queries fixed and allows us to prepare both the 'front' and 'back' of the query.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: greg/mentat#230
No description provided.