Molecule 0.16.1: a meta-DSL for the Datomic database

Hi all,

Just released v0.16.1 of the meta-DSL library Molecule (Github | Gitter | Docs) that makes it intuitive and type-safe in Scala to access the Datomic accumulate-only database where you can also query data back in time.

Molecule is a “meta-DSL” in that it generates boilerplate code from your initial schema definition so that
you can intuitively use the tokens of your domain as the core building blocks of queries and transactions:

Await.result(
  // Asynchronously get Person data and related Address
  Person.name.age.Address.street.getAsync, 
  1 second
) === List(
  ("Lisa", 20, "Broadway"),
  ("John", 22, "Fifth Avenue")
)

Compare Molecule syntax with: SQL, Slick, Datalog, Gremlin.

Hope you’ll give it a spin! Any feedback is welcome.

Cheers,

Marc Grue


Highlights of Molecule:

  • Intuitively use your domain terms as query tokens
  • Fully implemented Sync/Async APIs
  • Model any RDBMS, Graph, Document, KV-store etc.
  • Datalog queries for Datomic built at compile time
  • Nested queries of hierarchical data
  • Atomic transaction functions
  • Add meta data to transactions
  • Cross-cutting associative relationships
  • Developed and tested over the last 4 years (reached some maturity)
  • Fully documented (Docs)

Highlights of Datomic:

  • Fully transactional, cloud-ready, distributed database
  • Elastic scaling
  • Built-in caching - extremely low latency
  • Built-in auditing - query entire history of data
  • ACID-compliant transactions
  • Flexible and sound data model

Hi,

I am considering “molecule” for a project.
Can we have some update on its status ?

Is it still active ?
Any plan for scala 3 ?

Best regards,

Hi @guillaug - Thanks for your interest in Molecule!

Molecule is very much alive, just not in the current repo which as you have probably seen has not been active for the last year. I realised that I could make Molecule without macros and have spent the last year on coding the project from the ground up in a more flexible way which works with Scala 3 too.

Since there has been so many design experiments along the way, I decided to wait with uploading it until the basic design settled a bit. A quite complete Datomic implementation is now in place, with some features omitted compared to the old version. New is that the same molecules can now even be translated to sql queries (and more database languages to come)! I’ll look into uploading it, so stay tuned…

So for a short answer, you could easily start using the old version and then substitute it with the new version soon. Generic Indexes (AEVT etc), with/history time api’s and transaction functions are not in the new version (asOf and since are though). Will take some time to make new documentation, so this is a rough guide for now.

All the best,
Marc Grue

2 Likes

New molecule library uploaded: GitHub - scalamolecule/molecule

2 Likes