Fork me on GitHub
#datomic
<
2016-08-22
>
jethroksy09:08:09

@bkamphaus: thanks, it hadn't occurred to me that component was treated as a technical term before the above two posts. Forgive my mediocrity.

greywolve09:08:28

@bkamphaus Does d/with work on as-of db values ?

yonatanel11:08:47

Can I add a nil attribute value with the map form and expect it not to be asserted at all while the rest of the attributes are?

{:db/id (d/tempid :db.part/user)
 :order/status (get-status)}
;; get-status might return nil

robert-stuttaford11:08:37

no. you need to exclude it from your transaction

yonatanel11:08:05

thanks robert

robert-stuttaford11:08:17

(let [s (get-status)] (cond-> {:db/id (d/tempid :db.part/user)} s (assoc :order/status s)))

robert-stuttaford11:08:46

you probably aren't doing this, but you can't assert {:db/id ...} without at least one attr along with it

yonatanel11:08:54

yeah i have a bunch of them

pesterhazy12:08:05

so I'm not the sole inventor of the (cond-> m x (assoc :x x)) pattern. bummer

robert-stuttaford13:08:15

-grin- use the hell out of that pattern

bhagany15:08:58

@greywolve: I did an experiment over the weekend using d/with on as-of dbs, and I haven't seen any issues, fwiw

Ben Kamphaus15:08:02

I’ll have to defer to @marshall or @jaret re: anything changing with that behavior, but last I was aware with prospective transactions don’t change what an as-of database will find/retrieve with query, datoms, etc. - the with transaction is filtered out of the as-of db.

bhagany15:08:30

@jaret I saw that, and I was under the impression that that thread applies to doing the reverse

greywolve15:08:42

Thanks all 🙂

bhagany15:08:55

(d/as-of (d/with …)) does lead to unexpected results

bhagany15:08:10

(if you're expecting your d/with stuff to show)

marshall15:08:14

speculative branching (i.e. with) is only allowed on the “current” DB as-of is a filter, so I wouldn’t recommend doing either

nlessa16:08:17

Hi, I think I am understanding something wrong in the CORS option of REST APi. Isn’t it the way to specifying all origins allowed, eg, bin/rest -p 8001 -o /'*'/ ddb datomic:<ddb://us-east-1/nameofdynamodatabase>

zentrope17:08:53

When you retract an entity related to an isComponent attribute, is the history for that entity lost? I can’t find some of them even with (d/as-of db tx).

zentrope17:08:36

Oh. Hm. If a given TX has retracted an attribute, you have to use an earlier “value of the database” to find out what it was.

zentrope17:08:56

If that history datom indicates the attribute was “deleted”, then decrement the TX and run the query with the as-of db to find out what it pointed to. Seems to work.

Chris Bidler18:08:30

operational question: if you have a transactor running in EC2 and you want to schedule backups of the db, is the best practice to have a separate EC2 instance (or a Lambda function or what have you) with a separate Datomic install and a crontab? My initial thought was to add an /etc/cron.d entry in the CF template but my stumbling block is the fact that the actual install location of …/bin/datomic is not easily found

Chris Bidler18:08:41

which makes me suspect that I’m not supposed to use it for anything. 🙂

pesterhazy18:08:53

IMO better to use a separate instance. We use our jenkins for that

robert-stuttaford18:08:24

@chris_johnson we use a separate t2.medium which runs hourly. i haven't yet figured out how to make it run backups in a loop (start again as soon as you're done). it's NOT recommended to run backups on your transactor machine because of the CPU hit

robert-stuttaford18:08:39

backups run from storage directly, no need for transactor involvement!

Chris Bidler18:08:35

right, I was thinking since we don’t (yet) have anything running but transactors, and since I’m about to push a version update, maybe we could throw the cron job on the machine we have

Chris Bidler18:08:01

but I actually reached the same conclusion as you as soon as I read “please give backup as much memory as your transactor usually gets"

Chris Bidler18:08:29

our data is small and backups that have been done by hand are pretty snappy, I think I’m going to try doing it in a Lambda function

robert-stuttaford18:08:34

yeah, not a good idea. too much of a disturbance to transactor process. of course, we did exactly this for the first 18 months, when we ran a snowflake server with transactor, postgres, memcached, backups, and rabbitmq all on one instance 😄

Chris Bidler18:08:38

I will let you know how it goes

Ben Kamphaus19:08:21

I’ll just echo the recommendation to use separate instance and have it backup in a loop or at regular (frequent) time intervals.