Fork me on GitHub
#datomic
<
2016-02-14
>
jimmy10:02:51

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

val_waeselynck14:02:33

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

val_waeselynck14:02:44

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.

val_waeselynck21:02:12

Hi all, I just released a library to mock and fork Datomic connections in memory: https://github.com/vvvvalvalval/datomock Your feedback is welcome.

hueyp21:02:43

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

hueyp21:02:04

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? http://docs.datomic.com/backup.html#listing-backups

Ben Kamphaus21:02:54

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

hueyp21:02:24

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

hueyp21:02:35

but I did the backup like … november 😜

hueyp21:02:49

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?)

hueyp21:02:38

[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

hueyp21:02:50

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

hueyp21:02:54

not sure if that would matter

hueyp21:02:56

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

hueyp21:02:40

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).

hueyp21:02:48

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.)

hueyp21:02:38

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)

hueyp21:02:20

good to know!

hueyp21:02:21

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

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.

hueyp21:02:37

thanks for your help!

hueyp21:02:44

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