Fork me on GitHub

Why doesn't {:find [?e], :in [$ ?user], :where [[?e _ ?user]]} return anything? It returns the correct ?es if the wildcard _ is replaced with an concrete attribute like :org/member.

Ben Kamphaus02:01:40

@domkm what value is being passed in for '?user'?


@bkamphaus: An ident...but when you asked that I just tried with an eid and it worked. Thanks! But I don't understand why...

Ben Kamphaus02:01:00

Also, not confirmed or tested yet, but I suspect the exception logged by transactor will be more detailed than reported on peer when transactor function is invoked by transactor as a different process (i.e. Not mem)

Ben Kamphaus02:01:26

I believe ident resolution to entity id only works automagically when attribute bound is type ref - I.e. blank won't handle that case.


Ah, interesting


@bkamphaus: Regarding the transactor exception issue: If I throw an exception from inside a proper transactor function (not inside a query invoked by a transactor function) on a dev transactor, the exception is not swallowed. The full stacktrace is returned to the peer. The only difference between mem and dev that I can see is that dev exception data might be returned in Java types instead of Clojure types.


Hey, got a noob question: I’m trying to run this code…

  [;; Create the notification
   {:db/id #db/id[:db.part/user -1]
    :notification/id      (:id new-notification)
    :notification/content (:content new-notification)}
   ;; Create/update the user entity
   {:db/id [:user/id user-id]
    :user/notifications #db/id[:db.part/user -1]


…and I’m getting an error "datomic.impl.Exceptions$IllegalArgumentExceptionInfo: :db.error/invalid-attr-spec Attribute identifier quote of class: class java.lang.String does not start with a colon"


It seems to have to do with the :user/notifications #db/id[:db.part/user -1] since if I comment that out it disappears, but I’m flummoxed. Did I miss something obvious?


Oh, sorry, never mind… That exception is coming from elsewhere, I misread the stacktrace


Guys, should i download datomic free using wget ? I can do that in my computer, but always failed when do that to my softlayer server.


turns out the problem is in my server locales


@timgilbert: Unrelated note: use d/tempid in code instead of #db/id. #db/id is a reader literal, usually not what you want in code.


Thanks @stuartsierra. I saw a note about that somewhere, was a bit surprised that the above code seemed to work verbatim in my tests actually


@timgilbert: It will work, but it has surprising effects if you do, say, (defn make-tx [] [ ... #db/id[:db.part/user] ]]) because the db/id gets created once at read-time.


Oh, right... thanks, that looks like a subtle one. I do think I remember some discussion of it in one of the training vids, now that I think back


I don’t suppose the datomic-transactor-pro JAR is available in a maven repo anywhere?

Ben Kamphaus17:01:10

@jballanc: running the transactor requires the Datomic distribution (i.e. jar isn’t sufficient)


@bkamphaus: hmm…I’d argue otherwise (though I’m almost sure I’m off the “recommended” path)

Ben Kamphaus17:01:09

I’m speaking in terms of supported configuration. You could of course take the provided transactor jar and pom from, deps, etc. from the distribution and manage those assets in something like artifactory and generate your transactor invocation script and properties etc. on the fly and I’m sure there are people doing so to manage their datomic deployment/ops.


Yeah, that’s essentially what I’m doing. It’s just annoying that the transactor JAR is only available in the downloaded zip. It means having to automate the download/unzip/copy of the JAR from the zip instead of being able to manage it as a usual maven dependency.


@jballanc: my team uploaded the datomic jars to s3 via (which we were already using for private shared libs). Works like a charm for developers.

timgilbert21:01:59 need s3 though.


is there a canonical way to merge two entities?


@timgilbert: yeah, s3-wagon is probably going to be the easiest solution...


It was pretty straightforward, FWIW. I did need to pass -DcreateChecksum=true to the maven command to install in my local repository, but after that it was as easy as doing aws s3 sync ~/.m2/repository/com/datomic/datomic-pro/


I have another newbie question: since there doesn't seem to be a way to sort query results from either the pull or datalog sequence, I don't quite see the use of the (limit) function in the pull API. Like, which 10 values will be returned? And can I specify the offset to start with, like "10 results starting with the 25th result"?


I'm trying to figure out the best approach to do sorting and pagination in my app, basically


@timgilbert: There’s not really a good solution that I’ve found. You can come close by using < and > on the attribute of interest and managing a window on your own.


I think the limit function is really more just as a stop-gap when you might have very many large entities returned…less so for the usual pagination solutions that, for example, SQL’s limit is typically used for.


Ok, that makes sense, yeah


Definitely being able to specify sort order is the biggest thing that I'm missing going from postgres to datomic

Ben Kamphaus22:01:54

@timgilbert: no limit, offset, sort by, etc. in datomic datalog at present. Assuming you’re using JVM language and not REST API, remember peer is part of db with local caching, etc. so there’s not the same incentive to force everything through in one query.

Ben Kamphaus22:01:24

if you’re in a use case where you’re really paging, you probably need to use datoms instead, pulling or using the entity api as appropriate, rather than going through query.


Thanks @bkamphaus. Just curious, do you know if there is any consideration of this use case for future Datomic development? I do have several use cases where I will want to page / sort / etc, though I think I'll be able to use data modeling to limit my result set in a lot of them and just sort / take / drop the results in application code

Ben Kamphaus22:01:37

It’s definitely a use case we’re considering and sort/limit/offset are frequently requested features. That said, we don’t have anything planned for any particular release at this point in time.


@bkamphaus: it looks like my.datomic is down


if you weren’t already aware


Internal server error: exception