Fork me on GitHub

is it possible to lock the usage of d/delete-database (on-prem)? it feels a little too easy to kill the entire db?


(intern 'datomic.api 'delete-database (fn [_] (println "Nope!")))

😄 3

Haha! Yeah, outside of Francis's approach, we do not have a built in method for limiting api access. I have logged a feature request in this space and we will review options in this area.

Robert A. Randolph17:09:30

Hello there! We, at Cognitect, are collecting feedback regarding the getting started experience and entry points to dev-local. We'd love if you can communicate your feedback with us on the forum:


@UEFE6JWG4 I'm curious how quickly new accounts are approved on the forum (since I just signed up so I can read/reply to this).

Robert A. Randolph17:09:03

@U04V70XH6 I just approved yours. We're working to improve the forum experience in this regard.


Thanks -- I suspect you'll get quite a few new Datomic devs now dev-local is available 🙂


dev-local utterly rocks the casbah.


I'm watching the feedback on the forum and the main theme so far (and I've seen it mentioned on Twitter etc too) is the process for getting dev-local means it's hard to use for CI and for multi-dev teams since you can't just depend on a version on Maven/Clojars. The fill-out-form-and-download-via-email-link is fine for me for experimenting but I wouldn't like it much if I was trying to set up repeatable builds across a team or in a CI system. Could Cognitect perhaps clarify who the target audience really is for dev-local @UEFE6JWG4?

✔️ 6

It would be very surprising, imo, if the one of the objectives with dev-local was not to address the difficulty testing against Datomic Cloud during CI. Previously you'd need to figure out a complex docker setup with the Datomic socks proxy on CI and build your own db name prefix system. All of that is removed with dev-local.


@U04V70XH6 @U083D6HK9 we certainly intend for people to use dev-local in CI (and do so ourselves.)


We have always maintained a private maven repo for our CI system, and in that world it doesn't matter where a dep comes from. (The time and effort is in reviewing/approving a lib, not in copying it into S3.)


That said, we want to meet our users where they are, not where we are, so we are considering ways to make this better.


We used to run an instance of Apache Archiva for CI but it was a pain because it would randomly lock up/crash, and we only did it because Clojars wasn't always reliable. Since Clojars got a CDN, we pulled the plug on Archiva, and for the only custom dependency we have left, we use use a :local/root dependency to the JAR (and we keep versions of the JAR in a separate third-party repo under git because it's a lot easier than needing to worry about some external repo and making sure it's always available). Having to maintain a separate Maven-style repo just for a couple of JARs or deal with custom upload code and S3 is an overhead a lot of people don't want. Like I said on the forum, the current works for me and could work for us, because of how we have things setup, but I also have sympathy with other folks who feel this doesn't scale to larger teams or larger CI pipelines, in its current form.


Hi folks, Does anyone know if there is a way to specify a unique identity that encompasses multiple attributes? For example, say I have entities of the following shape:

{:foo/a ...
 :foo/b ...
 :foo/c ...}
I'd like such entities to have a unique identity specified by the combination of the attributes :foo/a and :foo/b and their values (but not :foo/c). (Roughly in SQL terms, I'm looking for a composite primary key.)


That seems like it! Did I understand this correctly: underlying the tuple are multiple datoms? IOW a tuple is not a single datom, whose value is a tuple, but rather multiple datoms, joined logically into a tuple?


a composite-tuple (there are two other kinds of tuples--this is only composite tuples) is a denormalization that datomic keeps up to date for you.


it’s not magic, if that’s what you are thinking. In the index will be a datom corresponding to that assertion


if you define a composite :foo/a+b composed of :foo/a and :foo/b and you assert or retract :foo/a or :foo/b on an entity, an additional assertion will be added`[entity1 :foo/a+b [value-of-a value-of-b]]`


it’s fully materialized




And can one of the elements of the tuple be an inverse relation?


For example, given the following entities:

{:bar/foos [{:foo/a ...
             :foo/b ...
             :foo/c ...}
            {:foo/a ...
             :foo/b ...
             :foo/c ...}]}
I'd like the tuple to be asserted on my foo entities to encompass :foo/a and :bar/_foos


My goal is to make it such that the children of bar are all unique with respect to :foo/a


> And can one of the elements of the tuple be an inverse relation? no


you can either reverse the relation, or consider using db/ensure or a transaction function to enforce your invariant


Thanks -- I'll explore the other routes


note that an absent value for a component will write a nil into the composite value, which can be a problem if you’re using this to enforce uniqueness with rel types


because of retractEntity’s behavior


(you don’t have to use it, but it’s common to)


noted, many thanks


If I have a list of tx-ids where I'll need to call d/as-of on each, are there any performance trade offs to consider? (e.g., should I sort the list desc/asc by tx before calling as-of)


It depends on what you are trying to do. Getting multiple asOf points against a particular entity may lose against walking the entire history. See also