Fork me on GitHub

Hi I am interested in using for my backend, Om for my front end and I would like to use Datomic for my database this is a library I may be able to use I'm curious how difficult is it to run Datomic outside of JVM. I am relatively new to programming so a layman's response is ideal. Thanks in advance!


you’d have to use the REST API


the peer lib is only available for the JVM


yo, I have datomic throwing an ArrayIndexOutOfBoundsException on a query. Is that a known bug in 0.9.5173? Or is this new?


the query looks like this:


(d/q '[:find ?k ?e
       :in $ ?run-name
       :with ?e
       [?s :yeller.sim/name ?run-name]
       [?e :yeller.operation/sim ?s]
       [?e :yeller/operation :yeller.db.operation/error]
       [?e :yeller/key ?k]]
     query run-name)


and here's the relevant bit of the stacktrace:

java.lang.Exception: processing rule: (q__60408 ?k ?e ?e), message: processing clause: [?e :yeller/key ?k], message: java.lang.ArrayIndexOutOfBoundsException: 2
        at datomic.datalog$eval_rule$fn__6156.invoke(datalog.clj:1441)
        at datomic.datalog$eval_rule.invoke(datalog.clj:1421)
        at datomic.datalog$eval_query.invoke(datalog.clj:1464)
        at datomic.datalog$qsqr.invoke(datalog.clj:1553)
        at datomic.datalog$qsqr.invoke(datalog.clj:1510)
        at datomic.query$q.invoke(query.clj:674)
        at datomic.api$q.doInvoke(api.clj:35)
        at clojure.lang.RestFn.invoke(
Caused by: java.lang.Exception: processing clause: [?e :yeller/key ?k], message: java.lang.ArrayIndexOutOfBoundsException: 2
        at datomic.datalog$eval_clause$fn__6130.invoke(datalog.clj:1387)
        at datomic.datalog$eval_clause.invoke(datalog.clj:1350)
        at datomic.datalog$eval_rule$fn__6156.invoke(datalog.clj:1436)
        ... 50 more
Caused by: java.util.concurrent.ExecutionException: java.lang.ArrayIndexOutOfBoundsException: 2
        at java.util.concurrent.FutureTask.get(
        at clojure.core$deref_future.invoke(core.clj:2186)
        at clojure.core$deref.invoke(core.clj:2207)
        at clojure.core$mapv$fn__6727.invoke(core.clj:6616)
        at clojure.lang.PersistentVector.reduce(
        at clojure.core$reduce.invoke(core.clj:6518)
        at clojure.core$mapv.invoke(core.clj:6616)
        at datomic.datalog$fn__5673.invoke(datalog.clj:588)
        at datomic.datalog$fn__5531$G__5503__5546.invoke(datalog.clj:51)
        at datomic.datalog$join_project_coll.invoke(datalog.clj:116)
        at datomic.datalog$fn__5602.invoke(datalog.clj:219)
        at datomic.datalog$fn__5510$G__5505__5525.invoke(datalog.clj:51)
        at datomic.datalog$eval_clause$fn__6130.invoke(datalog.clj:1356)
        ... 52 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 2
        at clojure.lang.RT.aset(
        at datomic.datalog$fn__5673$project__5744.invoke(datalog.clj:480)
        at datomic.datalog$fn__5673$join__5762.invoke(datalog.clj:578)
        at datomic.datalog$fn__5673$fn__5767$fn__5768.invoke(datalog.clj:588)
        at clojure.lang.AFn.applyToHelper(
        at clojure.lang.AFn.applyTo(
        at clojure.core$apply.invoke(core.clj:630)
        at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1868)
        at clojure.lang.RestFn.invoke(
        at clojure.lang.AFn.applyToHelper(
        at clojure.lang.RestFn.applyTo(
        at clojure.core$apply.invoke(core.clj:634)
        at clojure.core$bound_fn_STAR_$fn__4439.doInvoke(core.clj:1890)
        at clojure.lang.RestFn.invoke(
        ... 3 more


Ok so I get that I would have to use the REST API with Datomic when I use another language. My next question is... how easy is it to add and remove Datomic to a system? What if I decide to use some databases then want to add Datomic? Or I start with Datomic then I feel I am better off without it? I note that there is future plans to make Datomic available to non-JVM languages. So I am probably best off finding a workaround to use Datomic??? Though if I can easily add or pull it out I might start without it and build up to the point when I should add it.


@grounded_sage: easiest is probably to just play with it and form your own conclusions


I'm still relatively new to programming. Have yet to fully grasp database stuff let alone actually build something from scratch. I have something I really believe can change the world that I would like to build relatively quickly but still be maintainable (not wordpress or any other thing that tends to get in the way like others have said they could do it in) so I am essentially trying to get a good roadmap before I start pounding the pavement and getting stuck into it


I'd (1) try datomic before I'd decide one it and (2) use a jvm language


@tcrayford: In your query you’re using :with ?e and you’re asking to include ?e in the returned relations in the :find specification. The with clause specifically removes the provided vars from the relations.


Just chiming in - I'm currently working on a project that uses datomic from python, and I concur with the advice to use a JVM language if you can. Using REST comes with a few quirks (eg. the '[:find ?e .] syntax not working correctly), and more significantly, negates the benefit of not having to worry about round-tripping to an external data source.


I'll be following my own advice as soon as I can - Datomic just happens to be my way to sneak Clojure into the business simple_smile


@bhagany: thanks for your input. I'm really torn on this. I want to build an app similar to Meetup. The performance and fault tolerance of BEAM is definitely exciting but I'm mostly interested in the community behind it. I find on the server side there isn't really a well beaten path of app development other than a good tutorial with luminus (which I haven't done yet btw) and I am skeptical as to how many people use it. It also doesn't say anything about Datomic and Om which to me is the biggest things Clojure ecosystem has to offer. Since I have little plans to actually do heavy calculations etc I feel that Phoenix would be a better fit for me. I'd just love to be able to record immutable facts in time in my database :(


@marshall: aha. Once again I wish datomic and the Clojure community at large cared about error messages