Fork me on GitHub
#datomic
<
2016-01-14
>
domkm00:01:18

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'?

domkm02:01:08

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

domkm02:01:55

Ah, interesting

domkm02:01:19

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

timgilbert11:01:15

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

(d/transact
  (get-database-connection)
  [;; 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]
    }])

timgilbert11:01:38

…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"

timgilbert11:01:10

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?

timgilbert12:01:15

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

skadinyo13:01:25

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.

skadinyo15:01:50

turns out the problem is in my server locales

Lambda/Sierra15:01:46

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

timgilbert15:01:43

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

Lambda/Sierra15:01:54

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

timgilbert16:01:16

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

jballanc17:01:07

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)

jballanc17:01:08

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

jballanc17:01:57

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.

timgilbert21:01:12

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

timgilbert21:01:59

...you need s3 though.

max21:01:48

is there a canonical way to merge two entities?

jballanc21:01:39

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

timgilbert21:01:43

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/

timgilbert22:01:05

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"?

timgilbert22:01:46

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

jballanc22:01:11

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

jballanc22:01:10

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.

timgilbert22:01:33

Ok, that makes sense, yeah

timgilbert22:01:26

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.

timgilbert22:01:13

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.

kschrader23:01:50

@bkamphaus: it looks like my.datomic is down

kschrader23:01:57

if you weren’t already aware

kschrader23:01:09

Internal server error: exception