Fork me on GitHub
#datomic
<
2020-03-25
>
derpocious01:03:20

hey all! Anyone have a simple example of subscribing to changes of a datomic db? 🙏

derpocious01:03:20

Also, is there any common lein or boot templates to quickly scaffold out a CRUD backend for datomic (ideally a CRUDS starter template with subscriptions built-in as well!) thanks!

adamfeldman13:03:20

As far as backends go, the closest I’m aware of is the (alpha) Datomic plugin for Pathom Connect (EDIT: see following message for other good options!) https://github.com/wilkerlucio/pathom-datomic, https://github.com/wilkerlucio/pathom. If you’re looking for a frontend or full-stack solution, there’s Fulcro RAD (also in alpha and under rapid development) https://github.com/fulcrologic/fulcro-rad-demo, https://github.com/fulcrologic/fulcro-rad-datomic, https://github.com/fulcrologic/fulcro-rad. Note that Fulcro also uses Pathom internally, but RAD uses its own Datomic adapter. There exist nice ways of adding websockets to Fulcro (enabled via Sente), but I don’t belive it’s currently pre-integrated with Fulcro RAD etc https://github.com/fulcrologic/fulcro-websockets

adamfeldman13:03:02

If you already have the frontend settled, another option may be to stand up a GraphQL server. Lots of ways to do that. Over Postgres (or Yugabyte…) with https://hasura.io (supports subscriptions out of the box). To bridge Clojure(script) and GraphQL, you might use https://wilkerlucio.github.io/pathom/#GraphQL. There’s also this new, pure-Clojure GraphQL API creator for MySQL/Postgres https://github.com/graphqlize/graphqlize Hodur has an “experimental” adapter for declaratively creating a GraphQL API over Datomic (and lots more cool stuff) https://github.com/hodur-org/hodur-engine

derpocious17:03:54

Thanks @UCHV4JZ7A! Interesting, I've never heard of Panthom or "EQL"

derpocious17:03:34

I thought you could already ask for pieces of data with the standard Datomic api. If that is the case then isn't graphQL kind of unnecessary? :thinking_face:

adamfeldman17:03:40

I think one way to explain it is that EQL+Pathom or GraphQL both serve to decouple your frontend from the schema within your database. Datomic (as with all? SQL databases) is not intended to be exposed directly to a frontend client. This talk from the creator of Pathom may be enlightening: https://www.youtube.com/watch?v=IS3i3DTUnAI. There are a few other good Pathom (and Fulcro) talks out there from the same person

adamfeldman17:03:32

It’s possible you and I are dreaming about the same kind of thing — easily pull DB data from a SPA-style web frontend, with minimal setup. The closest I’ve found outside Clojure-land is https://github.com/marmelab/react-admin + https://github.com/hasura/ra-data-hasura. As it matures, I expect Fulcro RAD will enable a similar experience to that, but built on better and more flexible primitives that you can’t ever outgrow

adamfeldman17:03:51

(“Better” to me means a few things. React-admin is made out of the typical mish-mosh of tools from the react ecosystem, which I find to be highly “inconsistent”, with the added bonus of high churn and the resulting breakage. Fulcro RAD is still just Fulcro, which I find to be the closest thing to an internally-consistent framework in the Clojure(script) ecosystem — an ecosystem which itself prizes stability)

stuartrexking04:03:13

This is a question about datalog. I posted this on #datalog but there isn't my activity there. I appreciate any help as I'd like to understand this.

stuartrexking04:03:57

Is it a join? I think it's a join.

em07:03:33

@stuartrexking You probably shouldn't think of the function call so much as assignment as just binding. So yeah, it's just joining on different people with the same birth date. Another way to think about it is imagine if there was a :person/born-month and a :person/born-date attribute, you could replace the function call clauses with something like [?p1 :person/born-month ?m] [?p2 :person/born-month ?m]

stuartrexking07:03:25

Ah. That makes sense. Thank you.