Fork me on GitHub
#datomic
<
2017-06-09
>
az01:06:01

Do you no longer need to use: :db/id #db/id[:db.part/person]? Seeing the docs now reference: [{:db/ident :person/name

chelsey08:06:09

Hey anyone have a solution to combine pull expressions with aggregation in a single query?

chelsey08:06:29

For example, I know that pull expressions don’t support count, but is there a way to get a count included in the pull result?

robert-stuttaford09:06:29

@chelsey not as far as i can tell. Datalog’s pull expressions really just compose with d/pull directly. other than the argument order, i don’t think there’s any difference between the implementations

robert-stuttaford09:06:05

happily, though, you can just use multiple queries

chelsey09:06:22

Thanks Robert! Can you explain what you mean by multiple queries? Do you mean running d/q multiple times?

chelsey09:06:33

Let me give you a bit more context: Essentially, I have a Reddit-like tree structure, where there is no distinction between posts and comments. On top of this, “likes” are themselves entities, which I can retrieve easily with pull, but also need to return a count. I realize I can transform the data afterwards but was hoping there was a cleaner way of doing this.

karol.adamiec09:06:18

@chelsey well, i know your pain. it takes a lot to internalize that unique treat of datomic. Running multiple queries and post processing them IS the clean way in some sense (or to put it differently it definitely is not dirty!). we are not in kansas anymore 🙂

karol.adamiec09:06:01

on top of that multiple q could be more reusable as well….

robert-stuttaford09:06:47

@chelsey yes. or any combination of d/q d/entity d/pull. once you have that db value, you can query against it as much as you like, and your view on the data will be consistent

chelsey10:06:30

@karol.adamiec ahh it is painful, but I’ll accept it ¯\(ツ)

robert-stuttaford10:06:06

@chelsey think of Datomic less like a store of data ‘over there’ and more like a neat way to talk about data ‘over here’

robert-stuttaford10:06:28

sometimes you use map, filter, etc, and sometimes you use d/q, d/pull, etc. and very often you combine them

robert-stuttaford10:06:39

Datomic handles the ‘over-there’ness for you

uwo13:06:35

Our infrastructure team has configured our sql storage to use “Always on HA” for read-scale (https://docs.microsoft.com/en-us/sql/database-engine/availability-groups/windows/overview-of-always-on-availability-groups-sql-server). They assured me that it should be transparent to readers, but I’m curious if that sounds off.