Skip to content
CAI
Software that uses CAICheck a score

elixir-dbvisor/sql

64.3

Adequate · 18 September 2026

4.6k

lines of production code

Elixir

with C

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

This system is a self-contained SQL library for Elixir that replaces Ecto with a custom PostgreSQL driver and connection pool. It provides a BNF-driven lexer and parser to generate and validate SQL for multiple databases, including PostgreSQL, MySQL, and SQL Server. The library supports high-performance concurrent operations through atomic NIF primitives and integrates with the Mix build process to compile SQL definitions into Elixir modules.

Features

Add SQL adapters for ANSI, MySQL, PostgreSQL, and TDS

New adapter modules have been added to the library to support SQL generation and connection handling for ANSI SQL, MySQL, PostgreSQL, and TDS (SQL Server). The PostgreSQL adapter includes specific logic for binding parameter formatting, connection startup, SSL negotiation, and SCRAM-SHA-256 authentication, while the ANSI, MySQL, and TDS adapters provide base token-to-iodata conversion with their respective binding syntaxes ($1, ?, @1).

lib/adapters · high confidence

Add atomic concurrency primitives for Erlang NIFs

Introduces three new Erlang NIF modules—\atomic\_queue\, \atomic\_term\, and \bitset\—to provide high-performance, lock-free data structures. The \atomic\_queue\ module implements a multi-producer, multi-consumer queue with a connection pool for managing database connections, while \atomic\_term\ offers an atomic array for storing and retrieving Erlang terms across schedulers. The \bitset\ module provides an atomic bitset for tracking query preparation states. These additions enable more efficient concurrent operations within the application.

_c\src, src · high confidence

Initial configuration for SQL connection pooling

The application now includes environment-specific configuration files (dev, test, prod) that define connection pool settings for the :sql application. The development environment is configured with default PostgreSQL credentials pointing to localhost, while the test environment sets up multiple pools (default, scram, md5, ssl) with distinct ports and authentication methods to support varied testing scenarios.

config · high confidence

New Mix tasks for database lifecycle and SQL locking

This update introduces four new Mix tasks to the \lib/mix/tasks\ directory. \sql.create\ and \sql.drop\ allow users to create or drop databases for configured pools, supporting filtering by specific pool names via the \--pool\ option. \sql.get\ generates a \sql.lock\ file containing column metadata and validation logic for the configured adapters. Additionally, \sql.gen.test\ generates conformance test files from BNF rules and YAML definitions, provided the \:yamerl\ library is available.

lib/mix/tasks · high confidence

New SQL file compilation support via Mix compiler

Users can now compile .sql files as part of the standard Mix build process by adding :sql to their compilers list. This new Mix.Task.Compiler implementation parses SQL files using the project's lexer and parser, and automatically generates and compiles corresponding Elixir decoder modules into the build directory, ensuring SQL definitions are integrated into the application's compiled artifacts.

lib/mix/tasks/compile · high confidence

Behavioural changes

Introduce SQL application supervision, connection pooling, and BNF-driven lexer/parser

The library now starts as a proper OTP application that manages a configurable pool of database connections via \SQL.Pool\ (a supervisor-based pool with atomic queues) and loads adapter-specific queries at startup. A new \SQL.BNF\ module parses the ISO/IEC 9075-2 BNF grammar to derive keywords, operators, and terminals, which feed the rewritten \SQL.Lexer\ and \SQL.Format\ for tokenization and colored, indented SQL output. SQL generation is now handled by \SQL.Token\ (via the \\_\using\\_\ macro) and \SQL.Inspect\ for standard-compliant Inspect protocol output with error highlighting, while the old \SQL.Compiler\ and \SQL.String\ modules have been removed.

lib · high confidence

SQL library now uses self-hosted PostgreSQL driver and connection pool

The SQL library has transitioned from relying on Ecto for database connectivity to using its own self-hosted PostgreSQL driver and connection pool. This change introduces new functions \SQL.transaction/1\ and \SQL.stream/2\, allowing users to manage transactions and stream large datasets directly without Ecto. Configuration has shifted to a dedicated \:sql\ application config block for pool settings, and the development environment no longer auto-starts an Ecto repo, instead importing the SQL module directly in \.iex.exs\.

(repo-wide) · high confidence

Test coverage

Added comprehensive test coverage for SQL adapter string generation; Added integration tests for PostgreSQL adapter; Expanded test coverage for lexer, parser, and SQL composition.

Dependencies

Update dependencies and Elixir target version

The project now targets Elixir \~\> 1.19 and bumps the version to 0.6.0-dev. Development dependencies have been updated, including ex\_doc to 0.40.4 (with earmark\_parser 1.4.46 and makeup 1.2.2), and new dev/test dependencies yamerl and unicode\_set have been added. Several legacy dependencies (db\_connection, decimal, ecto, ecto\_sql, postgrex, telemetry) were removed from the lockfile, indicating a shift away from the previous Ecto/Postgrex stack for development/testing purposes.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Baseline

  • First survey — no prior run to compare against. CAI 64.

Lenses

  • Code Health 93
  • Architecture 82
  • Maturity 49
  • Readiness 67
  • Security 100

Changes since last survey

  • 106 commits — 93 feature/other, 13 fixes

By area

  • (root) — 45 commits
  • lib/adapters — 15 commits
  • .github/workflows — 7 commits
  • lib/mix — 7 commits
  • (repo) — 5 commits
  • lib/sql.ex — 5 commits
  • lib/format.ex — 4 commits
  • lib/parser.ex — 4 commits
  • lib/pool.ex — 3 commits
  • lib/lexer.ex — 2 commits
  • lib/token.ex — 2 commits
  • test/adapters — 2 commits
  • benchmarks/bench.exs — 1 commit
  • config/dev.exs — 1 commit
  • lib/bnf.ex — 1 commit
  • lib/helpers.ex — 1 commit
  • test/sql_test.exs — 1 commit

Notable commits

  • fix: Fix a couple of minor bugs
  • fix: Fix binding index and in
  • fix: Fix code interpolation
  • fix: Fix conformance test after cte fix (#16)
  • fix: Fix doc generation
  • fix: Fix readme
  • fix: fix cte in update bug (#15)
  • fix: fix indention in formatter
  • fix: fix node creation for special charecters
  • fix: fix perfomance regressions
  • fix: fix resolve_column in parser
  • fix: fix sql.get
  • fix: fix unary operators, comparison and for keyword
  • change: Add @doc false to undocumented fucntions
  • change: Add CONTRIBUTING.md
  • change: Add Mix tasks for database create and drop
  • change: Add Postgres GiST operators #17 (#18)
  • change: Add SECURITY.md
  • change: Add SQL Mix.Task.Compiler
  • change: Add SQL.map/2 and impl enumerable
  • …and 86 more

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

elixir-dbvisor/sql was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 18 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 13a3978737b1b45c07b92e4519cf704f8c881134 — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-5d04157a340d.