This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-02-02
Channels
- # aws-lambda (1)
- # beginners (46)
- # boot (190)
- # cider (12)
- # clara (6)
- # cljs-dev (9)
- # cljsjs (8)
- # clojure (152)
- # clojure-austin (3)
- # clojure-berlin (3)
- # clojure-finland (2)
- # clojure-france (5)
- # clojure-italy (3)
- # clojure-russia (92)
- # clojure-serbia (4)
- # clojure-spec (7)
- # clojure-uk (190)
- # clojurescript (115)
- # cursive (20)
- # datomic (20)
- # dirac (4)
- # emacs (9)
- # gsoc (5)
- # hoplon (1)
- # jobs (1)
- # klipse (4)
- # lein-figwheel (1)
- # leiningen (6)
- # lumo (2)
- # mount (18)
- # off-topic (57)
- # om (68)
- # om-next (14)
- # onyx (33)
- # perun (32)
- # portland-or (4)
- # re-frame (21)
- # reagent (85)
- # ring (6)
- # ring-swagger (23)
- # schema (1)
- # uncomplicate (1)
- # untangled (13)
- # vim (7)
are db/ids guaranteed to never change? e.g. during migration from one underlying storage to another, or some maintenance event that i'm not aware of. trying to determine if i should rely on them for things like URLs
I think the conventional wisdom is that you shouldn't rely on entity ids
They might change in future versions of datomic, perhaps due to repartitioning (but that's not happening currently)
Even now, they make it hard to re-import a dataset
Entity ids don't change when restoring a backup, but when you build your own backup/restore solution (for a partial database), you'll end up with a new set of entity ids
A good strategy is to pick a primary key and to use lookup refs
They don't allow you to set it. So anything shared externally than needs to move from Database A to Database B should have another id assigned.
[:user/guid #uuid "..."]
is a drop-in replacement for entids almost everywhere
you're welcome!
I have a beginners' question... how can I do a d/transact and also get the entity ID as a result / return val?
Make a tempid, keep it, transact, keep the :tempids result, then use that function to get a real entid from the two
(note I rarely do this anymore, using upserting attrs and refetching by lookup ref is what you want to do most of the time)
is there a good answer yet for using spec on EntityMaps? s/keys
fails because an EntityMap is not a map?
@favila thanks! I was just coding up the same thing (d/transact and then do a query to get the entity id)
the joy of clojure is real ! 😃