scalasql

Scala ORM to query SQL databases from Scala via concise, type-safe, and familiar case classes and collection operations. Connects to Postgres, MySql, H2, and Sq

What is scalasql?

Scala ORM to query SQL databases from Scala via concise, type-safe, and familiar case classes and collection operations. Connects to Postgres, MySql, H2, and Sqlite out of the box

Overview of scalasql

What it is

ScalaSql is a Scala ORM library that allows type-safe low-boilerplate querying of SQL databases using standard Scala collections operations running against typed Table descriptions. It connects to PostgreSQL, MySQL, Sqlite, MSSql and H2 databases out of the box.

Key features

  • Type-safe queries using case classes and collection operations (e.g., .filter, .map, .sortBy, .sum)
  • Supports PostgreSQL, MySQL, Sqlite, MSSql, and H2 databases - Low-boilerplate table definition with a Table trait and case class - Alternative SimpleTable variant for Scala >=3.7.0 using named tuples - ZIO integration via scalasql-zio module for effectful database operations - Configurable name mapper and SQL logging

Use cases

  • Building type-safe database access layers in Scala applications - Querying relational databases with familiar Scala collection syntax - Rapid prototyping with in-memory Sqlite or production databases - Integrating with ZIO-based applications for effectful transactions

Getting started

Add the dependency to your build.mill file: scala ivy com.lihaoyi::scalasql:0.3.0 For Scala >=3.7.0 with named tuple support, use the scalasql-simple module: scala ivy com.lihaoyi::scalasql-simple:0.3.0 For ZIO integration, add: scala ivy com.lihaoyi::scalasql-zio:0.3.0 ScalaSql requires Scala >=3.6.2.

License and pricing

Licensed under the MIT License. Open source and free to use.

Based on the project's public README and repository metadata.

Add this badge to your README

Featured on YunoDB Badge styles & help

Maintain this project? Show that it is featured on YunoDB.

Markdown[![Featured on YunoDB](https://yunodb.com/badge/com-lihaoyiscalasql.svg)](https://yunodb.com/tools/com-lihaoyiscalasql?utm_source=github&utm_medium=badge)
HTML<a href="https://yunodb.com/tools/com-lihaoyiscalasql?utm_source=github&utm_medium=badge"><img src="https://yunodb.com/badge/com-lihaoyiscalasql.svg" alt="Featured on YunoDB" height="20"></a>