Slick
Functional Relational Mapping (FRM) library for Scala — the standard Scala database access layer. Slick maps Scala collections operations (filter, map, flatMap, join) to SQL queries at compile time, providing type-safe database queries without raw SQL strings. Supports PostgreSQL, MySQL, SQLite, H2, and Oracle via JDBC. Key features: type-safe queries via Slick's lifted embedding DSL, async non-blocking database access via Scala Futures, plain SQL support (sql"SELECT..."), and schema code generation from existing databases. Alternative to Doobie (more functional) and Quill (macro-based).
Score Breakdown
⚙ Agent Friendliness
🔒 Security
Parameterized queries prevent SQL injection. Type-safe DSL makes injection structurally impossible for DSL queries. Plain sql interpolator (sql"") requires careful use — use $column.bind for parameterized values not string interpolation. TLS via JDBC URL for database connection.
⚡ Reliability
Best When
You're building Scala applications that need type-safe SQL access with async Futures, particularly when using Play Framework or Akka where Slick's Future model integrates naturally.
Avoid When
You're using Cats Effect/ZIO (use Doobie instead — better FP integration), want ORM-style active record patterns, or need a lighter database library without Slick's DSL learning curve.
Use Cases
- • Build type-safe database access for Scala agent backends using Slick — compile-time query validation prevents SQL mistakes in agent data persistence code
- • Implement async non-blocking database access for Play Framework agent APIs using Slick's Future-based execution model
- • Use Slick's schema code generation (slick-codegen) to generate Scala table definitions from existing agent databases — reverse-engineer schemas into type-safe Table classes
- • Query agent data with Scala collection-like syntax — filter(_.status === "active").sortBy(_.createdAt.desc).take(10) compiles to SELECT SQL with type safety
- • Write complex agent data queries mixing Slick DSL and plain SQL — Slick's sql"" interpolator for queries too complex for the DSL, with automatic type mapping
Not For
- • Teams wanting a more functional database layer — Doobie (Cats Effect/ZIO) provides a more purely functional approach; Slick's Future-based model is less composable with pure FP
- • Simple CRUD without complex queries — Exposed (Kotlin) or Quill (compile-time SQL generation) may be simpler for straightforward CRUD in Scala/JVM projects
- • Non-Scala JVM applications — use Spring Data JPA (Java) or Exposed (Kotlin) for Java/Kotlin; Slick is Scala-specific
Interface
Authentication
Database library — no auth concepts. Database credentials configured in application.conf or environment variables passed to Database.forConfig.
Pricing
Slick is BSD 2-Clause licensed, maintained by Lightbend. Free for all use.
Agent Metadata
Known Gotchas
- ⚠ Slick 3.x async model requires db.run() — all Slick DBIO actions must be executed via db.run(action) which returns a Future; Slick queries don't execute until run() is called; building complex query chains before run() is correct
- ⚠ Table definitions require auto-lifting — simple Scala case classes need TableQuery[T] lift; forgetting to call tableQuery.result vs tableQuery alone is a common mistake returning a Query not a DBIOAction
- ⚠ Slick DSL operator precedence — === for equality (not ==), =!= for inequality; using == instead of === compiles but compares column objects not values, returning wrong results silently
- ⚠ N+1 query problem — Slick doesn't auto-join like ORMs; loading related data requires explicit join queries or sequential db.run calls; agent data with associations needs explicit query planning
- ⚠ Connection pool exhaustion under load — default DatabaseConfig pool settings may be too small; configure numThreads and queueSize in application.conf; pool exhaustion causes TimeoutException in Futures
- ⚠ Slick 3.x and Cats Effect/ZIO integration requires bridges — slick-cats or zio-slick provide interop; don't mix raw Slick Futures with Cats IO directly without proper unsafeRun bridging
Alternatives
Full Evaluation Report
Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for Slick.
Scores are editorial opinions as of 2026-03-06.