Fork me on GitHub
#datomic
<
2015-11-04
>
grounded_sage05:11:57

Hi I am interested in using http://www.phoenixframework.org/ 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 https://github.com/edubkendo/datomex 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!

robert-stuttaford07:11:42

you’d have to use the REST API

robert-stuttaford07:11:51

the peer lib is only available for the JVM

tcrayford12:11:37

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

tcrayford12:11:31

the query looks like this:

tcrayford12:11:34

(d/q '[:find ?k ?e
       :in $ ?run-name
       :with ?e
       :where
       [?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)

tcrayford12:11:03

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(RestFn.java:439)
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.report(FutureTask.java:122)
        at java.util.concurrent.FutureTask.get(FutureTask.java:192)
        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(PersistentVector.java:333)
        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(RT.java:2326)
        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(AFn.java:152)
        at clojure.lang.AFn.applyTo(AFn.java:144)
        at clojure.core$apply.invoke(core.clj:630)
        at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1868)
        at clojure.lang.RestFn.invoke(RestFn.java:425)
        at clojure.lang.AFn.applyToHelper(AFn.java:156)
        at clojure.lang.RestFn.applyTo(RestFn.java:132)
        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(RestFn.java:397)
        at clojure.lang.AFn.call(AFn.java:18)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        ... 3 more

grounded_sage13:11:36

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.

pesterhazy14:11:50

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

grounded_sage14:11:12

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

pesterhazy14:11:04

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

marshall15:11:09

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

bhagany17:11:59

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.

bhagany17:11:29

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

grounded_sage22:11:51

@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 :(

tcrayford23:11:29

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