Fork me on GitHub

hi guys how do we implement sort and filter in datomic ?


@nxqd: datomic queries return sets, so you'll want to sort as a post-processing step


and what do you mean by filter ?

Ben Kamphaus19:02:31

@nxqd as @val_waeselynck says you don’t do this at the datalog level, but it’s fairly easy to get any equivalent e.g. SQL ORDER BY from Clojure by calling sort-by` on query results, e.g. (sort-by first (d/q '[:find ?ident ?doc :where [?e :db/doc ?doc][?e :db/ident ?ident]] (d/db conn))). Note that sort-by can be called with a comparator to get ascending or descending (or arbitrary sort) behavior.


Hi all, I just released a library to mock and fork Datomic connections in memory: Your feedback is welcome.


do you need the same version of datomic to restore a backup?


I’m getting a :restore/no-roots when pointing to s3 (it shows owner / roots / values when I look at it) but its with a newer version than the backup (which is old) so wondering if that would cause it

Ben Kamphaus21:02:18

@hueyp: backup/restore should be compatible across versions. What do you see when you invoke list-backups?

Ben Kamphaus21:02:54

there is a windows specific issue that manifests as what you’re seeing, also (as of yet unresolved)!topic/datomic/O6LVi2OjvJ4 but workaround is to provide a valid t.


I’m on amazon linux atm … trying out a restore


but I did the backup like … november 😜


I saved a snapshot of the db too just in case so can use that I think simple_smile

Ben Kamphaus21:02:06

if you use aws command line for s3 you can list the bucket contents fine, though? (i.e. it’s not a role/permissions issue from the instance?)


[ec2-user@ip-172-30-3-77 datomic-pro-0.9.5350]$ aws s3 ls 
                           PRE roots/
                           PRE values/
2015-11-21 18:19:18         52 owner


I’m not using ec2 credentials but have .aws/credentials set


not sure if that would matter


I’m copying it local atm to try that out as well


its possible I was running a free version maybe ...

Ben Kamphaus21:02:45

hm, for all my backup cases I’m pointed at a subfolder of the bucket (i.e. not directly at the bucket), not sure if backup dir == bucket (no reasoning apart from the fact that it’s different between configs).


but that can’t backup to s3 so probably not?

Ben Kamphaus21:02:09

even from free version, backup is storage/version agnostic. free can’t backup to s3 I don’t believe (doesn’t contain AWS deps, etc.)


okay, so maybe having an empty prefix (or whatever, no folder) is an issue … once its done sync’ing local I can just try that out

Ben Kamphaus21:02:49

only issue you’ll have with local copy and s3 is it has to have integrity, may take multiple calls to sync etc. for a full robust copy if it’s large (an issue we see when people copy from s3 bucket to s3 bucket is files not always making it through)


good to know!


[ec2-user@ip-172-30-3-77 datomic-pro-0.9.5350]$ bin/datomic list-backups file:/home/ec2-user/backup/

Ben Kamphaus21:02:13

glad it shows up fine locally! should be good to go. if you try restore and get any segment missing errors will need to attempt sync/copy again to see if anything from s3 is missing.


thanks for your help!


nice, restore started (had to quote an ampersand in the uri for postgres woops)