Fork me on GitHub
#datomic
<
2015-08-28
>
robert-stuttaford07:08:37

sdegutis: the macro is for .edn files. you should use d/tempid in your code, as #db/id reader macros produce one value only

robert-stuttaford07:08:05

(fn new-id [] #db/id[:db.part/user] ) this would return the same value how ever many times you call it

robert-stuttaford07:08:00

#db/id is a convenient way to specify a one off temp-id in a data-only manner

robert-stuttaford07:08:07

such as in schema.edn

Kira Sotnikov07:08:09

Hm, are the way to do restoring to DDB a bit quicker? Might be are there any best practices?

Kira Sotnikov10:08:59

robert-stuttaford: hah, why I didn't find it 😞

robert-stuttaford10:08:06

perhaps you can increase the ddb write throughput

robert-stuttaford10:08:13

for the duration of the restore

Kira Sotnikov10:08:25

Hm, interesting

Kira Sotnikov10:08:58

Will carefully learn it simple_smile

Kira Sotnikov14:08:16

Concurrency option and increasing ddb write throughput did restorin much quicker

Kira Sotnikov14:08:44

Also, restoring is continious and begin from last interrupt. It's pretty cool

sdegutis16:08:15

Does it make sense to give entities a UUID (if they don't already have a unique-based attribute) so that you don't have to resolve their :tempids after the transaction, and instead you can just return the UUID you gave to whoever needs it (which can then be used in a Lookup Ref)?

sdegutis16:08:48

I've been seriously considering that technique for a few days, and the only drawback I can see is that it's an extra attribute and potentially superfluous data (considering the :db/id is essentially the same thing).

sdegutis16:08:39

But there are two benefits for this: (1) you don't have to resolve the tempid, and (2) the UUID can be shared/consumed externally whereas the :db/id cannot.

raywillig16:08:27

@sdegutis: datomic best practices document seems to suggest the uuid approach though they don't specifically say use a uuid. the example they give of using a unique identity is a uuid generated with datomic's index friendly squuid function

marshall16:08:24

@sdegutis: Yes, @raywillig is correct. That is a good approach b/c entity IDs are not guaranteed to be stable across i.e backup/restore, etc, so whenever possible you should supply a domain identifier or an externally unique identifier: http://docs.datomic.com/best-practices.html#unique-ids-for-external-keys

sdegutis17:08:12

In this case, there seems to be little to no use for Datomic users to use :db/id, right?

sdegutis17:08:47

It seems like the only place it would ever be used is to ensure that a transaction creates a new entity (via {:db/id (d/tempid :db.part/user) ...}).