4 ms·
Datomic Console
- MaxGabriel 13y agoHave people used Datomic? What has your experience been like?
- coolsunglasses 13y agoUsing it at my company with Clojure, quite happy with it. I prefer it to RDBMS as a default OLTP store now. Cannot recommend it enough for the sorts of things one would use PostgreSQL for. Support has been quite good too. Only regrets/dislikes: 1. It's a young product and it shows. 2. Migrations. z0mg. I'm working on a library that I will open source sometime in the next month hopefully to ameliorate the pain here. 3. I wish we had compromised less on the schema for legacy reasons.
- tony_landis 13y agoI am curious if you could expound on #3. I am starting a migration myself.
- coolsunglasses 13y agoWe got stuck with stringly references for reasons related to a very strange semantic/relational database origin data source and having limited access to the data source. Generation two of the thing I'm working on is likely to dump this data model and force object graph realization directly to native Datomic db/refs so that I can use the damn datom indexes properly.
- kinleyd 13y agoI've used it for hobby projects. Really like it.
- danneu 13y agoI've been using it on my past few small projects where I would've otherwise used Postgres, so I mostly have CRUD-level experience with it with no meaningful insights within the rest of this comment. The query interface (Datalog: http://www.learndatalogtoday.org/ http://www.learndatalogtoday.org/) is immediately refreshing, simpler, and nicer to write than SQL. Of course, you also get to use Clojure data-structures. Datomic itself feels like the best of both worlds across relational and nosql databases. Although I often wonder if I'm even taking advantage of it since I'm still so table-brained. For me, the hardest part about Datomic is that you're sorta on your own. Expect to do some internet-snippet window-shopping to throw a sensible db.clj namespace together. And be sure to peep Stuart Halloway's gists. Honestly, I still don't know a good strategy to migrate schema changes, my hand-rolled attempt at a db.clj abstraction is comically bad, and since I don't know the Right Way to do anything, I just throw in more `juxt` until things work. But it's all worth it. There's no chorus of noobs to scavenge from nor have they trodden down the path before you. In fact, I think I'm the noob chorus. And instead of trailblazing a path for you, I've become stuck in the first bramblebush. https://github.com/Datomic/day-of-datomic/tree/master/tutorial https://github.com/Datomic/day-of-datomic/tree/master/tutori... is the best resource I can point to.
- kinleyd 13y ago"In fact, I think I'm the noob chorus. And instead of trailblazing a path for you, I've become stuck in the first bramblebush." You are not alone. :)
- tony_landis 13y agoWere you already experienced with Clojure? I am just starting out with Clojure, so datomic being such a young database makes things challenging.
- danneu 13y agoMy Clojure experience doesn't really help me with Datomic, although my knowledge of Clojure isn't very deep. That hard part about Datomic for me is that there's no book of best practices or any sort of cookbook that I'm aware of. For example, the first obvious thing you probably want in Datomic is an auto-incrementing ID. In fact, that's the first thought I probably had when I tried to run my first Datomic query: "Wait... my user doesn't have a unique ID". So the first order of the day was to create an auto-incrementing ID system, something I hadn't seen in the few tutorials I'd found (so it surprised me that I had to make one). But I found something called a "transaction function" in a blog post that sort of did what I needed and I came up with this: {:db/id #db/id[:db.part/user] :db/ident :addUID :db/fn #db/fn {:lang :clojure :params [db new-eid attr] :code (let [res (datomic.api/q '[:find (max ?uid) :in $ ?attr :where [_ ?attr ?uid]] db attr) new-uid (inc (or (ffirst res) 0))] [[:db/add new-eid attr new-uid]])}} You pass it :user/uid, :topic/uid, :post/uid or whatever you may have, and it finds the max `uid` for all entities that have the `:user/uid` attribute. Then it either adds 1 to it or starts at 0 if none exist. But I didn't really know where to put that. So I copied a Stuart Halloway repo and put it in a `resources/data_functions.edn` file. And I copied DayOfDatomic's code that actually loads it: (defn create-db [] (d/delete-database uri) (d/create-database uri) (let [conn (d/connect uri)] (transact-all conn "resources/schema.edn") (transact-all conn "resources/data-functions.edn") conn)) But my workflow for this kind of thing is still to just recreate the database from scratch since I'm not sure how to do it incrementally, like in a migration. And I restart the transactor every time. Moral of this story being that I'm just faking it til I make it. But despite all of this, I made it farther in Datomic with a couple resources than I would've made it with Postgres and Sinatra with a couple resources. And once you get some sort of good-enough, hilarious scaffolding up and running, it's easy enough to make incremental progress from there as you need it. If it helps, a while back I documented my first effort with Datomic where I built a database that stores author data from OpenLibrary[2]. But on second look, it's reallly long and aimless. Much like this post. [1]: http://www.danneu.com/posts/authordb-datomic-tutorial/ http://www.danneu.com/posts/authordb-datomic-tutorial/ [2]: https://openlibrary.org/developers/dumps https://openlibrary.org/developers/dumps