I see two problems with Datomic: the pricing seems a bit high for home use, and the professional version has the problem that you have to submit your data to the cloud, which is not always possible as clients may not always allow sharing of data with 3rd-parties. The ideas seem interesting though. Is there an open-source equivalent of Datomic yet?
Building a CRUD App with Datomic Cloud Ions
11–20 of 28 posts
Re: Building a CRUD App with Datomic Cloud Ions
#12I see two problems with Datomic: the pricing seems a bit high for home use, and the professional version has the problem that you have to submit your data to the cloud, which is not always possible as clients may not always allow sharing of data with 3rd-parties. The ideas seem interesting though. Is there an open-source equivalent of Datomic yet?
Re: Building a CRUD App with Datomic Cloud Ions
#13Earlier quoted context omitted.
> "find two friends with same birthdays that also have cars of same color" Wasn't that always a simple thing to do, e.g. in SQL? And how about monitoring changes in the database based on a query? Is that possible and efficient?
You can do it in SQL, but it's not simple. Something like: WITH stuff AS ( SELECT bday, carcolor, ROW_NUMBER() OVER ( PARTITION BY bday,carcolor ORDER BY bday,carcolor ) rownum FROM friends ) SELECT * FROM stuff WHERE rownum > 1;
select f1.id, f2.id from friends f1, friends f2 where f1.bday = f2.bday and f1.carcolor = f2.carcolor and f1.id > f2.id;
Re: Building a CRUD App with Datomic Cloud Ions
#14Earlier quoted context omitted.
You can do it in SQL, but it's not simple. Something like: WITH stuff AS ( SELECT bday, carcolor, ROW_NUMBER() OVER ( PARTITION BY bday,carcolor ORDER BY bday,carcolor ) rownum FROM friends ) SELECT * FROM stuff WHERE rownum > 1;
You could write this as a simple join too, right? At least assuming the friends table has a primary key. select f1.id, f2.id from friends f1, friends f2 where f1.bday = f2.bday and f1.carcolor = f2.carcolor and f1.id > f2.id;
Re: Building a CRUD App with Datomic Cloud Ions
#15Earlier quoted context omitted.
Performance is brutal though. For a moderately sized db client side datascript can be 100ms per interesting query unless you drop to indices. Might as well just do a server trip. I had a beautiful dream of just streaming datomic out to datascriot but eventually gave up and went back to client side maps using reframe. If Cognitect would release a performant JavaScript peer that would be a game changer for web dev. Jus…
Raw index access from the client introduces data security issues amongst other things ... Perhaps someday trusted computations can be done in the edge. Otherwise we're talking about browser DRM.
Re: Building a CRUD App with Datomic Cloud Ions
#16Earlier quoted context omitted.
It's possible in SQL, in Datascript it's effortless. There's a big difference in mental overhead and thus how often you would want reach into DB. There are other benefits. You don't do any string mungling, your query is itself composed of data structures. You can build it easily with code, so your queries become as elaborate as you can generate them. Unlike SQL tables that you have to figure out from start, the data…
> As for monitoring changes, I'm using the Posh lib (also mentioned in article). It monitors the DB and re-renders react component if there are transactions relevant to component's queries. It seems very efficient so far, but I still have to test it with large number of components and transactions. Interesting. Do you know if, upon a change, it reruns the queries from scratch, or does it update the results based on t…
For truly reactive datalog subscriptions, let's see what happens with clj-3df project. Unlike Datascript, it requires you to use server infrastructure right from start.
Re: Building a CRUD App with Datomic Cloud Ions
#17I'm working on a web app using the mentioned Datascript library. It is in-memory DB with Datalog query language, written as open-source implementation of Datomic principles. It's usable from Clojure(script) and JS. Takes some time to adapt way of thinking to its data model and I'm just starting to reap the benefits. Boy does this thing pack some serious power! Prodding the data for complex relations ("find two friend…
I hope more Datalog gains more interest in the frontend world, because it's about as declarative you can get – something that should go hand-in-hand with declarative frontend libraries like React. I hope that someone moves the frontend world further with an implementation in JavaScript. Datascript is a good start, but its size (80kb gzipped) and its JavaScript API can greatly be improved upon.
Re: Building a CRUD App with Datomic Cloud Ions
#18Earlier quoted context omitted.
You can do it in SQL, but it's not simple. Something like: WITH stuff AS ( SELECT bday, carcolor, ROW_NUMBER() OVER ( PARTITION BY bday,carcolor ORDER BY bday,carcolor ) rownum FROM friends ) SELECT * FROM stuff WHERE rownum > 1;
You could write this as a simple join too, right? At least assuming the friends table has a primary key. select f1.id, f2.id from friends f1, friends f2 where f1.bday = f2.bday and f1.carcolor = f2.carcolor and f1.id > f2.id;
Re: Building a CRUD App with Datomic Cloud Ions
#19Earlier quoted context omitted.
You could write this as a simple join too, right? At least assuming the friends table has a primary key. select f1.id, f2.id from friends f1, friends f2 where f1.bday = f2.bday and f1.carcolor = f2.carcolor and f1.id > f2.id;
Both of you are missing the point. Once you normalize, car color would be an attribute on the car table, and to map those you need many-to-many lookup tables. It can be done obviously, but it's more effort to do, maintain and update. Depending on your requirements, graph db like features can provide an easier abstraction.
Similarly, don't expect that a single data model will suffice for all needs in an application. Expect to have to maintain anything that is useful.
Re: Building a CRUD App with Datomic Cloud Ions
#20Earlier quoted context omitted.
Performance is brutal though. For a moderately sized db client side datascript can be 100ms per interesting query unless you drop to indices. Might as well just do a server trip. I had a beautiful dream of just streaming datomic out to datascriot but eventually gave up and went back to client side maps using reframe. If Cognitect would release a performant JavaScript peer that would be a game changer for web dev. Jus…
Raw index access from the client introduces data security issues amongst other things ... Perhaps someday trusted computations can be done in the edge. Otherwise we're talking about browser DRM.