You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to evaluate if Datascript is the right tool for a problem I'm trying to solve.. and I was wondering how I might accomplish a (full) outer join or equivalent.
For Datomic I found the following article, which mentions two approaches (entity navigation or extension function), and I was wondering if either of these would work with Datascript:
The thing about datomic and datascript is that you often can create two queries on the exact same dereffed db, then merge the two result sets, either by a third query or some other means.
In this particular example, I would create two result-sets for id:s, make a union of them and then do pull in a query to get the outer join.
Activity
Harleqin commentedon Nov 26, 2018
maybefor the Datomic example is defined here: https://github.com/Datomic/day-of-datomic/blob/bdb8b4c40c0d8d18b1465b6a7f2f2ce4da226991/src/datomic/samples/query.cljDatascript has a different model of where the schema is kept, but this should be translatable.
tonsky commentedon Nov 26, 2018
You can always pass your own fn to the query:
There are also
missing?andget-elsesupported in both Datomic and DataScript: https://docs.datomic.com/on-prem/query.html#get-elseI guess it really depends on your task, but what exactly are you trying to accomplish?
alza-bitz commentedon Nov 30, 2018
I'm basically looking at ways to do a full outer join in the traditional sense..
For example given "widgets":
and "gadgets":
I'm trying to investigate if it would be possible to produce a full outer join (say on
idfor example, but could be a different attribute):If that makes sense?
claj commentedon Dec 3, 2018
The thing about datomic and datascript is that you often can create two queries on the exact same dereffed db, then merge the two result sets, either by a third query or some other means.
In this particular example, I would create two result-sets for id:s, make a union of them and then do pull in a query to get the outer join.
Like:
tonsky commentedon Dec 6, 2018
This worked for me
Unfortunately
get-elsedoesn’t accept nil as default value, but using any other value instead works.