datomic

Ask questions on the official Q&A site at https://ask.datomic.com!
Aron 2020-09-01T05:16:21.170Z

I don't think you should care so much about entity ids. And no, I don't think an entity can exist just with one datom, but I could be wrong, haven't checked it.

seancorfield 2020-09-01T05:47:42.170200Z

@hiskennyness : > Good points all. I am going to save all these for my Datomic tutorial before they scroll off the Clojurian history. This channel is archived to Zulip as https://clojurians.zulipchat.com/#narrow/stream/180378-slack-archive/topic/datomic which is a full, searchable history back to whenever the @zulip-mirror-bot was added to this channel.

1🎉
seancorfield 2020-09-01T05:48:24.170600Z

(I figured this was a good opportunity to remind folks of the free, searchable archive of many channels here!)

3
2020-09-01T10:51:17.171100Z

For development we have a custom implementation of d/q-protocol which sends queries to tap>. it enables us to see what performance is of specific queries. we just wrap the existing connection in our system-map.

cmdrdats 2020-09-01T13:49:00.171300Z

ah, cool, thanks!

cmdrdats 2020-09-01T13:50:52.172500Z

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

jaret 2020-09-01T13:51:25.172600Z

Yes, every transaction is written to durable storage. However, Cloud's use of DDB is opaque unless accessed from Datomic. So, I am not sure what insight you would get by reviewing the stream of writes other than "writes are occurring," which you could also see by monitoring with metrics in CloudWatch (txdatoms, txbatchbytes) or by reviewing the Cloud Dashboard (txes,Txbytes DDB usage, write count). I am interested in hearing more about what you're envisioning with DBstreams, maybe there is something here we should look at as a feature for Datomic. 🙂

souenzzo 2020-09-01T14:27:42.173Z

@stuarthalloway bit off but which maven repository do you use/recommend for small corps//personal experimentation?

favila 2020-09-01T15:55:40.173200Z

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

1😄
jaret 2020-09-01T16:16:30.173600Z

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.

2020-09-01T17:27:30.175900Z

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

stuarthalloway 2020-09-02T14:15:07.189500Z

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

stuarthalloway 2020-09-02T14:16:24.189700Z

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

stuarthalloway 2020-09-02T14:17:12.189900Z

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

3
seancorfield 2020-09-02T16:29:11.193900Z

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.

2➕
seancorfield 2020-09-01T17:45:07.176100Z

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

2020-09-01T17:46:03.176300Z

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

seancorfield 2020-09-01T17:46:31.176500Z

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

stuarthalloway 2020-09-01T19:47:56.177Z

I tend to use an S3 bucket -- a maven repo is just a convention about files.

2020-09-01T19:53:49.180Z

I was thinking of the tx-report-queue functionality in the peer library and how that might be possible in Cloud.

dregre 2020-09-01T19:54:12.180300Z

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

timcreasy 2020-09-01T20:05:24.180500Z

Sounds like you are looking for these: https://docs.datomic.com/cloud/schema/schema-reference.html#composite-tuples

dregre 2020-09-01T20:21:30.182900Z

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?

favila 2020-09-01T20:29:15.183100Z

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.

favila 2020-09-01T20:29:40.183300Z

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

favila 2020-09-01T20:31:44.183500Z

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

favila 2020-09-01T20:31:59.183700Z

it’s fully materialized

dregre 2020-09-01T20:53:32.183900Z

Interesting

dregre 2020-09-01T20:53:40.184100Z

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

dregre 2020-09-01T20:57:33.184300Z

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

dregre 2020-09-01T20:58:08.184500Z

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

favila 2020-09-01T21:05:53.184700Z

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

favila 2020-09-01T21:06:32.184900Z

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

dregre 2020-09-01T21:07:32.185100Z

Thanks -- I'll explore the other routes

favila 2020-09-01T21:07:46.185300Z

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

favila 2020-09-01T21:08:14.185500Z

because of retractEntity’s behavior

favila 2020-09-01T21:08:31.185700Z

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

dregre 2020-09-01T21:09:20.185900Z

ah yes

dregre 2020-09-01T21:09:29.186100Z

noted, many thanks

kenny 2020-09-01T22:16:06.187400Z

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)

stuarthalloway 2020-09-02T14:19:07.190100Z

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.

kennytilton 2020-09-01T22:48:45.187500Z

dev-local utterly rocks the casbah.

seancorfield 2020-09-01T23:10:21.187700Z

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 @audiolabs?

2✔️
kenny 2020-09-01T23:27:38.188Z

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.