elixir-dbvisor/sql
67.2
Adequate · 15 November 2026
4.6k
lines of production code
Elixir
with C
5
measurements over time
What this system is
This system is a self-hosted SQL library for Elixir that provides a complete parsing, execution, and connection pooling stack without relying on external ORMs like Ecto. It supports multiple database protocols including PostgreSQL, MySQL, and TDS, offering low-level concurrency primitives and tools for schema introspection and database lifecycle management. The library enables developers to write type-safe SQL queries through a macro-based interface and compile SQL definitions directly into BEAM code.
Features
Add SQL adapters for ANSI, MySQL, PostgreSQL, and TDS
New SQL adapters have been introduced for ANSI, MySQL, PostgreSQL, and TDS (SQL Server) protocols. These adapters handle protocol-specific token formatting, such as binding placeholders ($N for PostgreSQL, @N for TDS, ? for ANSI/MySQL), and include implementation details for connection management, SSL/TLS support, and authentication (including SCRAM-SHA-256 for PostgreSQL). The PostgreSQL adapter also includes logic for querying database metadata (schema, columns, types) and managing database creation and deletion.
lib/adapters · high confidence
Add low-level NIF modules for atomic queues, term arrays, and bitsets
Introduces three new Erlang NIF modules—\atomic\_queue\, \atomic\_term\, and \bitset\—backed by C implementations (\atomic\_queue.c\, \atomic\_term.c\, \bitset.c\). The \atomic\_queue\ module provides a high-performance, lock-free queue with a connection pool (supporting \new\, \register\_connection\, \checkout\, \checkin\, \dequeue\, and \reclaim\ operations) designed for concurrent connection management. The \atomic\_term\ module offers a thread-safe array for storing and retrieving Erlang terms atomically (\new\, \put\, \get\). The \bitset\ module provides an atomic bitset for tracking query preparation states (\new\, \mark\_prepared\, \is\_prepared\). These components form the foundational concurrency primitives for the database connection layer.
_c\src, src · high confidence
Initial configuration for SQL database connection pools
The application now includes environment-specific configuration files (dev, test, prod) that define database connection pool settings. The development environment is configured with default Postgres credentials pointing to a local database, 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
Introduce SQL parser, lexer, and connection pooling infrastructure
The library now includes a complete SQL parsing and execution stack. A new \SQL.Application\ module manages the supervision tree, starting a \SQL.Pool\ for database connections and loading adapter queries. The \SQL.Lexer\ handles tokenization with support for Unicode and special characters, while \SQL.BNF\ parses the ISO/IEC 9075-2 grammar to define keywords and operators. SQL generation is handled by \SQL.Token\ (via the \\_\using\\_\ macro) and \SQL.Format\ for iodata output, with \SQL.Inspect\ providing standard Elixir inspect behavior. A \SQL.Counter\ GenServer tracks usage statistics persisted via Dets. The previous \SQL.Compiler\ module has been removed.
lib · high confidence
New Mix tasks for database lifecycle and SQL locking
Added four new Mix tasks to manage database operations and SQL schema locking: \sql.create\ and \sql.drop\ allow users to create or drop databases for configured pools (with optional \--pool\ and \--quiet\ flags), \sql.get\ generates a \sql.lock\ file containing column metadata and validation logic for the configured adapters, and \sql.gen.test\ generates conformance test files from BNF rules when the \:yamerl\ library is available.
lib/mix/tasks · high confidence
New SQL file compilation support via Mix compiler
Users can now compile .sql files by adding :sql to their mix.exs compilers list. The new Mix.Tasks.Compile.Sql task parses SQL files using the project's lexer and parser, and automatically generates and compiles Elixir decoder modules for the resulting AST, making SQL definitions available as compiled BEAM code.
lib/mix/tasks/compile · high confidence
Postgres adapter gains database maintenance and schema introspection capabilities
The Postgres adapter now includes a new \SQL.Adapters.Postgres.Queries\ module that provides functions for managing database lifecycles and introspecting schema metadata. Users can now create and drop databases with configurable options (such as encoding, template, and collation settings) via the \create\_database\ and \drop\_database\ functions, and check for database existence using \count\_database\. Additionally, the adapter can now retrieve detailed column metadata from the \information\_schema\ and map PostgreSQL type OIDs, enabling more robust schema analysis and type handling within the application.
lib/adapters/postgres · high confidence
Self-hosted PostgreSQL driver and connection pool
SQL no longer relies on Ecto for database connectivity; it now includes its own PostgreSQL driver and connection pool. This change introduces \SQL.transaction/1\ for managing transactions and \SQL.stream/2\ for efficiently streaming large result sets, allowing users to execute queries and handle concurrency without an ORM layer.
(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
Dependency updates and project configuration changes
This release updates several development dependencies: ex\_doc is upgraded from 0.37 to 0.40.4, and yamerl is added as a new dev/test dependency. The project also bumps the required Elixir version from 1.18 to 1.19, renames the package from SQL to \~SQL, and updates the version to 0.6.0-dev. Additionally, the mix.lock file reflects these changes and includes updates to makeup, makeup\_elixir, makeup\_erlang, and earmark\_parser versions.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 67 → 67 (-0.2)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.4) — scores are not directly comparable.
Lenses
- Code Health 94 → 85 (-9.0)
- Architecture 86 → 86 (+0.0)
- Maturity 53 → 54 (+1.2)
- Readiness 69 → 69 (+0.0)
- Security 100 → 100 (+0.0)
Resolved (2)
- Hotspot: lib/adapters/postgres.ex (lib/adapters/postgres.ex)
- Hotspot: lib/parser.ex (lib/parser.ex)
New (18)
- Edited copies of one member (3 members, 2+ corresponding lines) (lib/parser.ex)
- Edited copies of one member (3 members, 8+ corresponding lines) (lib/adapters/postgres.ex)
- Edited copies of one member (4 members, 39+ corresponding lines) (lib/lexer.ex)
- Edited copies of one member (5 members, 6+ corresponding lines) (lib/adapters/postgres.ex)
- Edited copies of one member (5 members, 8+ corresponding lines) (lib/parser.ex)
- Edited copy of a member (1 corresponding lines) (lib/bnf.ex)
- Edited copy of a member (12 corresponding lines) (lib/mix/tasks/sql.create.ex)
- Edited copy of a member (22 corresponding lines) (lib/lexer.ex)
- Edited copy of a member (26 corresponding lines) (lib/lexer.ex)
- Edited copy of a member (3 corresponding lines) (lib/adapters/postgres.ex)
- Edited copy of a member (3 corresponding lines) (lib/parser.ex)
- Edited copy of a member (30 corresponding lines) (lib/lexer.ex)
- Edited copy of a member (31 corresponding lines) (lib/lexer.ex)
- Edited copy of a member (4 corresponding lines) (lib/format.ex)
- Edited copy of a member (4 corresponding lines) (lib/parser.ex)
- Edited copy of a member (8 corresponding lines) (lib/adapters/postgres.ex)
- Edited copy of a member (8 corresponding lines) (lib/adapters/postgres.ex)
- Edited copy of a member (8 corresponding lines) (lib/adapters/postgres.ex)
Written by cca.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 15 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit b1e8862850b62fc4d5e76ceff8415ad7b83ebd92 — the exact code this score is about.
- Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.65+preprod-3c33c1882dc1.