Add SQLite as the seventh supported dialect - #44
Merged
Conversation
Adds SQLite as the seventh supported dialect via the xerial sqlite-jdbc driver (3.49.1.0). SQLite has only five storage classes (NULL, INTEGER, REAL, TEXT, BLOB), no procedures, and no nested types — the implementation is correspondingly smaller than the others. - SqliteTypename / Read / Write / Json / Types / SqliteType - SqliteConfig with builder for in-memory, shared in-memory, and file paths plus journal_mode, synchronous, busy_timeout, foreign_keys, date_class, and date_string_format options - DatabaseKind.SQLITE + product/driver detection - DatabaseSystem.SQLITE for OpenTelemetry - Kotlin and Scala wrappers (SqliteType + SqliteTypes) with the standard primitive-conversion pattern - SqliteTypeTest covers JSON roundtrip, DB roundtrip, opt() round-trip with a non-null value, query analysis (column-only and with parameter) for every type — exhausting all seven "positions" SQLite has - BigDecimal stored as plain TEXT because the xerial driver's setBigDecimal/getBigDecimal throw "column -1 out of bounds"; storing as TEXT preserves precision exactly Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ates
- New site/docs/sqlite.md mirroring the DuckDB page structure: storage
classes, type affinity rules, every SqliteType, date/time text-storage
rationale, BigDecimal text-storage workaround, what SQLite doesn't have
(no procedures/arrays/structs/maps), connection config, and query
analysis behavior
- 12 snippet sections × 3 languages = 36 new compile-checked example
files in documentation-examples-{java,kotlin,scala}/.../docs/sqlite/
- Landing page (site/src/pages/index.js): "Six databases" → "Seven
databases", Hero list and typeGrid include SQLite (INTEGER, REAL, TEXT,
BLOB, NUMERIC, BOOLEAN, DATE/DATETIME/TIMESTAMP, UUID, JSON, STRICT
tables)
- sidebars.js + database-types.md add the SQLite entry under "Database
Types"
- stored-procedures.md adds SQLite as N/A row alongside DuckDB
- query-analysis-database-behavior.md gets SQLite columns in all four
matrices, backed by direct probes of the xerial driver: column types
full, nullability partial (base columns OK, expressions/aggregates all
reported nullable), outer-join nullability not adjusted (same trap as
PostgreSQL), parameter types unusable (driver throws until all params
bound, then echoes back the bound type rather than the column type)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…tests
Two latent bugs surfaced while wiring SQLite, both because SQLite's
:memory: connection-per-database semantics expose paths that DuckDB's
test suite never exercised.
* SingleConnection.transactor() returned underlying.transactor(), which
built TransactorJdbcImpl against the wrapped SimpleDataSource and
bypassed the singleton-connection proxy entirely. Each transact() then
opened a fresh in-memory database, so the table from the previous
transact was gone. Fix: hold a typed reference to SimpleDataSource and
build the transactor against `this`. Affects SQLite and DuckDB :memory:.
* QueryAnalysis.styledReportBody() never rendered the prepareFailure;
it was added to allErrors() to mark the report with ✗ but the
sqlState, driver message, and parsed hint never appeared in the body.
Users saw a ✗ with no explanation. Fix: emit prepareFailure.styledMessage()
before the parameters/columns tables.
* QueryAnalysisTest assertions for testReportFormatting and
testReportColoredVsPlain were written against the pre-CheckReport
refactor format ("Parameters", "Columns", "error" literals); updated
to match the current format which uses ✗ glyphs and a "declared"
table header.
* New transactorEndToEnd() test in both DuckDbTypeTest and
SqliteTypeTest exercises the public ConnectionSource → Transactor →
Fragment flow. The original DuckDbTypeTest pokes raw JDBC via
ConnectionJdbc, which is why the SingleConnection routing bug stayed
hidden until SQLite triggered it.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
org.xerial:sqlite-jdbc:3.49.1.0) as the seventh dialect alongside PostgreSQL, MariaDB, DuckDB, Oracle, SQL Server, and DB2. NewSqliteType/SqliteTypes/SqliteConfigplus Kotlin and Scala wrappers, full docs page and snippets, and anSqliteTypeTestthat exercises every type in every "position" SQLite supports (column read/write, WHERE-parameter, NULL viaopt(), non-null viaopt(), query analysis, query analysis with bound parameter — there are no others, since SQLite has no nested types).SingleConnection.transactor()routing bug uncovered by SQLite's:memory:tests: the wrapper delegated tounderlying.transactor(), which built the transactor against the unwrappedSimpleDataSourceand bypassed the singleton-connection proxy. Eachtransact()then opened a fresh in-memory database. Affects DuckDB:memory:too — masked becauseDuckDbTypeTestpoked raw JDBC instead of going through the transactor. AddedtransactorEndToEnd()smoke tests to bothSqliteTypeTestandDuckDbTypeTestso future regressions of this shape fail loudly.QueryAnalysisreporting bug:PrepareFailurewas added toallErrors()for the✗summary indicator but never rendered in the report body, so users saw a✗with no driver message or hint. Now emitted before the parameters/columns tables.Three commits
feat(sqlite): add SQLite dialect support— core dialect (SqliteType/Read/Write/Json/Types/Typename/Config), Kotlin & Scala wrappers,DatabaseKind.SQLITE, OTelDatabaseSystem.SQLITE, build wiring, full type-roundtrip testdocs(sqlite): add SQLite docs page, snippets, and analyzer matrix updates—site/docs/sqlite.md, 36 snippet files (12 sections × 3 languages), landing page (Six → Seven databases), sidebar,database-types.md,stored-procedures.md, and the four analyzer-behavior matrices inquery-analysis-database-behavior.md(backed by direct probes of the xerial driver, not guesses)fix: SingleConnection routing + PrepareFailure rendering, end-to-end tests— the two bug fixes above plus three pre-existingQueryAnalysisTestassertion updates that referenced the old report formatSQLite-specific design notes
transactorEndToEndtest creates a STRICT table.SqliteTypes.date/.time/.datetime/.timestamp/.instantall read and write ISO-8601 TEXT, matching the xerial driver's defaultdate_class=TEXT. Sub-millisecond precision is silently truncated byLocalDateTimewrites;Instantround-trips at full nanosecond precision becauseInstant.toString()does.setBigDecimal/getBigDecimalthrowcolumn -1 out of bounds; storing as plain text viasetString/getString+BigDecimal::toPlainStringround-trips and preserves arbitrary precision (a side benefit, since SQLite has no enforced precision either way).SqliteType.outParam()returnsOptional.empty(). The docs page enumerates the absent features.SqliteTypes.integeracceptsINTEGER,INT,INT2,INT4,INT8,BIGINT,SMALLINT,TINYINT,MEDIUMINT,UNSIGNED BIG INTsoCREATE TABLE t (x BIGINT)analyses cleanly.Test plan
bleep compile foundations-jdbc foundations-jdbc-hikari foundations-jdbc-spring foundations-jdbc-kotlin foundations-jdbc-scala— cleanbleep test foundations-jdbc-test -o dev.typr.foundations.SqliteTypeTest— 2 passed (matrix + transactor end-to-end)bleep test foundations-jdbc-test -o dev.typr.foundations.DuckDbTypeTest— 4 passed (now includes transactor end-to-end)bleep test foundations-jdbc-test -o dev.typr.foundations.QueryAnalysisTest— 70 passed (was 67 + 3 failing pre-existing)npm run buildinsite/— Docusaurus build clean,/docs/sqlite/index.htmlrendered, all 36 snippets resolved🤖 Generated with Claude Code