Skip to content

v0.24.0 SQL focus

Choose a tag to compare

@marcgrue marcgrue released this 08 Jul 22:00
· 94 commits to main since this release

This release marks a new chapter for Molecule: full focus on SQL backends. All Datomic-related code and infrastructure have been removed, resulting in a cleaner, more focused, and more powerful Molecule going forward.

Goodbye Datomic

Molecule’s early support for Datomic played a key role in its evolution, but it also brought challenges:

  • Diverging APIs due to Datomic limitations — like pull semantics — that couldn’t fully align with Molecule’s expressive model
  • Workarounds and complexity added to compensate for backend differences
  • Conditional compliance tests scattered across the codebase
  • Fragmentation of the Molecule mental model across backends

This release simplifyes the core and let Molecule fully embrace the capabilities of SQL.

A Single Unified Query Model

SQL provides richer composability and with Datomic gone, Molecule can now fully support powerful constructs that were previously constrained:

  • Deeply nested optional joins
    e.g. get books with or without reviews, optionally filtered by rating
  • Optional paths at any level
    e.g. retrieve countries with or without cities, cities with or without mayors
  • Combinable conditions across attributes and nested layers
    e.g. optional pattern matches, null-aware filters
  • Rich card-many joins with filtering, ordering, slicing
  • Native support for sorting, limit, and offset
    (previously only possible in memory after querying full result sets)

This model aligns more closely with how we mentally structure data, allowing the full expressiveness of the Molecule DSL to shine — without backend compromises.

Simplified Project Structure

With the removal of Datomic:

  • All modules are now SQL-only
  • Module references are shorter and clearer
  • The project structure is leaner and easier to navigate

This improves build performance, onboarding speed, and overall maintainability.

Philosophy: One Powerful Molecule

By focusing entirely on SQL, Molecule can now deliver a single, consistent experience:

  • One expressive, composable, nested query language
  • One coherent API across all supported SQL databases
  • Full optionality at every level: entities, attributes, relationships
  • Uniform compliance across all supported backends — verified by 1800+ tests

What's Changed

  • All Datomic code and backends removed
  • Project restructured for SQL-only usage
  • Simplified imports and module resolution
  • Minor breaking changes in DSL due to project layout cleanup

Updated Dependencies

You can now choose any of the supported SQL databases in your sbt project:

"org.scalamolecule" %% "molecule-db-postgres" % "0.24.0"
"org.scalamolecule" %% "molecule-db-sqlite"   % "0.24.0"
"org.scalamolecule" %% "molecule-db-mysql"    % "0.24.0"
"org.scalamolecule" %% "molecule-db-mariadb"  % "0.24.0"
"org.scalamolecule" %% "molecule-db-h2"       % "0.24.0"

Also use the updated sbt-molecule plugin:

addSbtPlugin("org.scalamolecule" % "sbt-molecule" % "1.19.0")

Refer to the GitHub README for the latest setup instructions.

Migration Notes

  • If you’re using Datomic, please remain on Molecule v0.23.x. This release does not support Datomic and is not backwards compatible with the multi-backend structure.
  • If you’re already using Molecule for SQL, upgrading to v0.24.0 should be seamless.
    Just check your import paths and module references.