This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-01-12
Channels
- # admin-announcements (8)
- # alda (11)
- # announcements (53)
- # architecture (2)
- # aws (10)
- # beginners (69)
- # boot (403)
- # braid-chat (160)
- # cider (10)
- # cljs-dev (14)
- # cljsjs (26)
- # cljsrn (34)
- # clojure (223)
- # clojure-art (1)
- # clojure-brasil (4)
- # clojure-dev (10)
- # clojure-france (1)
- # clojure-gamedev (1)
- # clojure-nl (14)
- # clojure-russia (20)
- # clojure-seattle (8)
- # clojure-sg (1)
- # clojurebridge (2)
- # clojurescript (156)
- # code-reviews (2)
- # community-development (305)
- # cursive (5)
- # datavis (33)
- # datomic (38)
- # devcards (4)
- # dirac (39)
- # dunaj (3)
- # emacs (5)
- # events (2)
- # funcool (45)
- # hoplon (3)
- # instaparse (24)
- # jobs (2)
- # ldnclj (77)
- # lein-figwheel (4)
- # leiningen (1)
- # mount (49)
- # nyc (14)
- # off-topic (52)
- # om (125)
- # omnext (4)
- # onyx (13)
- # other-lisps (1)
- # overtone (8)
- # parinfer (31)
- # plastic (6)
- # portland-or (3)
- # quil (4)
- # re-frame (6)
- # reading-clojure (16)
- # reagent (212)
- # ring-swagger (11)
- # robots (5)
- # spacemacs (4)
- # specter (1)
- # yada (26)
I've been using the repl that comes with datomic (bin/repl) for all of my datomic repl needs, but I'm finally feeling the need to use a repl from emacs. However, I'm using the rest api, and I don't have a lein or boot project that cider can hook into. Should I make a dummy project just to start it with cider, or is there some way to accomplish this that I'm missing?
fyi, we're working on a slack replacement and might use datomic https://hackpad.com/collection/wnikaeBENEE
How choose storage for datomic? Is there any Guiding principles? I read the documentation about how set up for various storage db, but not about choice.
@alwaysbcoding: this probably isn't terribly helpful, but your example looks a lot like what I do from python. I don't do anything special with the ?vars
the error suggests to me that your query datastructure isn't being coerced to a string before being sent?
@isaac: the canonical advice is to use whatever is operationally easiest for you. for example, if you already have postgres in production, use that. I have also seen people say that if you're on AWS, consider using dynamo.
@isaac: @bhagany the last thing is that cassandra's probably the easiest/best if you don't have any other particular choice any particular way and want distributed/perf etc and cannot use dynamo
yes, only cassandra 2.0 and 2.1
Probably, at some point.
Hey, I’m new to datomic and could use some guidance solving a problem. Let’s say I have some book entities that have a :book/color attribute which could be :red, :green, or :blue. Let’s say also that I have a map of colors to ordinal values {:red 1 :green 2 :blue 3} which I don’t have stored in datomic. I’d like to have a query that, given an eid and such a map, returns the ordinal value of the book’s color. (I realize this is trivially done after the fact; I’m actually working on a transaction fn for which I think a solution to this simple problem will help.)
My naive attempt fails:
(defn get-book-color-ordinality
[db eid color-ordinals]
(d/q '[:find ?ord
:in $ ?eid ?ords
:where
[?eid :book/color ?color]
[(get ?ords ?color) ?ord]]
db eid color-ordinals))
Nevermind, this does seem to work, I had just mixed up the type of my color attrs
But it doesn’t work as a txn fn; datomic complains with:
java.lang.RuntimeException: Unable to resolve symbol: ?ords in this context
Any clue why this might be true? I even get this when I inline the color-ordinals map.
Does anyone know why I would be able to successfully use d/with
but transacting the same tx-data to an unchanged connection would fail with a java.lang.ExceptionInInitializerError
?
Even weirder, transacting this particular data does work against an in memory connection but it does not work against a free dev connection. I'm stumped (and blocked). Any ideas? CC @bkamphaus @stuartsierra
Sorry, I got nothing @domkm
@stuartsierra: Thanks for responding. Would you pass this on to your colleagues?
I’ve written up a simple gist illustrating the txn-fn problem I’m having: https://gist.github.com/dball/f4cd5a52dddc7b812b86
The former form is a macro which generates a txn fn suitable for installation in a schema; the macro is well tested and I have no reason not to trust it. It fails when used in a txn. The latter form works exactly as intended locally. I’m not sure why; are clojure map literals not allowed within clojure txn fns?
@marshall: It's sort of a contrived example because I don't intend to use that exact code in production (which essentially prevents any concurrent modification), but I intended to do something related and, now that I know the above works in a mem transactor but not in a dev transactor, I am concerned about the approach.
@domkm is it the invocation of the txn function that fails or the installation of it?
@marshall: Installation works fine in both mem and dev. Let me get back to you on dev invocation...
@marshall: Dev invocation works as well. I used this tx-data: '[[:fn/query {:query [:find ?e :where [?e :person/email "foo"]]}]]
@domkm: The snippet is invoking one query to make an exception, and a second query using that exception as an arg, to throw an exception if the db has been changed and no longer has the basis-t 1031?
@bkamphaus: Almost exactly. It doesn't invoke the query which makes and throws an exception. It simple returns that query in a list and the transactor invokes it after splicing it in.
@domkm: I guess I’m not clear whether this is the intended use case of opening query in a transaction function, or a contrived example meant to illustrate a failure. That said, a suspect for the deserialize exception might be something that does a sequence manipulation in a transaction function that requires a clojure map or vec specifically rather than targeting a java.util.Hashmap
as the precision of type preservation for collections is only guaranteed at the interface level (well, I think, either way it’s not preserved for the exact type) on the wire. That would produce something like the symptom you describe, where something would work on mem, but not dev/free. Maybe the assoc
or cons
in the code for :fn/query
would be the points where the failure is encountered?
(speculation, not tested at this point)
@bkamphaus: Okay, thanks, I'll test that.
@bkamphaus: Hmm, so you're correct that they are not Clojure data structures but assoc
and cons
are working as I expected on this: '[[:fn/query {:query [:find ?e :where [?e :person/email "foo"]]}]]
I'm confused
@domkm: I’ll use your transaction function code and investigate a bit more, see if I can identify what the exact issue is. Will update after digging some.
@bkamphaus: Thank you!