Fork me on GitHub
#datomic
<
2020-09-01
>
cmdrdats13:09:52

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

favila15:09:40

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

😄 3
jaret16:09:30

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 https://docs.datomic.com/cloud/dev-local.html getting started experience and entry points to dev-local. We'd love if you can communicate your feedback with us https://forum.datomic.com/t/requesting-feedback-on-dev-local-getting-started/1608/2 on the forum: https://forum.datomic.com/t/requesting-feedback-on-dev-local-getting-started/1608/2

seancorfield17:09:07

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

seancorfield17:09:31

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

kennytilton22:09:45

dev-local utterly rocks the casbah.

seancorfield23:09:21

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
kenny23:09:38

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.

stuarthalloway14:09:07

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

stuarthalloway14:09:24

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

stuarthalloway14:09:12

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

9
seancorfield16:09:11

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.

6
dregre19:09:12

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

dregre20:09:30

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?

favila20:09:15

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.

favila20:09:40

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

favila20:09:44

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]]`

favila20:09:59

it’s fully materialized

dregre20:09:32

Interesting

dregre20:09:40

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

dregre20:09:33

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

dregre20:09:08

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

favila21:09:53

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

favila21:09:32

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

dregre21:09:32

Thanks -- I'll explore the other routes

favila21:09:46

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

favila21:09:14

because of retractEntity’s behavior

favila21:09:31

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

dregre21:09:29

noted, many thanks

kenny22:09:06

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)

stuarthalloway14:09:07

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 https://docs.datomic.com/cloud/time/filters.html#filter-or-log.