Skip to content

feat: multi-dialect SQL support (MySQL, SQLite, DuckDB, BigQuery)#104

Merged
richardwooding merged 3 commits intomainfrom
feature/multi-dialect-support
Feb 25, 2026
Merged

feat: multi-dialect SQL support (MySQL, SQLite, DuckDB, BigQuery)#104
richardwooding merged 3 commits intomainfrom
feature/multi-dialect-support

Conversation

@richardwooding
Copy link
Contributor

Summary

  • Add pluggable Dialect interface (~40 methods) enabling cel2sql to generate SQL for PostgreSQL, MySQL, SQLite, DuckDB, and BigQuery from a single CEL expression
  • Add per-dialect type providers with LoadTableSchema support for runtime schema introspection from live databases (MySQL via information_schema, SQLite via PRAGMA table_info, DuckDB via information_schema, BigQuery via client API)
  • Add per-dialect index advisors generating dialect-appropriate DDL recommendations (BTREE/GIN/trgm for PG, BTREE/FULLTEXT for MySQL, BTREE for SQLite, ART for DuckDB, CLUSTERING/SEARCH_INDEX for BigQuery)
  • Add shared test infrastructure (testcases/, testutil/) with per-dialect expected SQL and a multi-dialect test runner
  • Add integration tests for SQLite (in-memory), MySQL (testcontainer), and BigQuery (testcontainer emulator)
  • Extract dialect-agnostic schema types into schema/ package
  • Update README with multi-dialect documentation, dialect comparison table, CGO warning for DuckDB, and expanded Requirements section

Test plan

  • make ci passes (fmt, lint, test, vuln-check)
  • All existing PostgreSQL tests continue to pass (backward compatibility)
  • New per-dialect unit tests pass for MySQL, SQLite, DuckDB, BigQuery
  • Integration tests pass: SQLite (in-memory), MySQL (testcontainer), BigQuery (emulator, amd64 only)
  • Provider tests validate type mapping for each dialect
  • Index advisor tests verify DDL generation per dialect

🤖 Generated with Claude Code

richardwooding and others added 3 commits February 24, 2026 15:15
Move FieldSchema, Schema, NewSchema, and related types from pg/ into a
new schema/ package to decouple them from PostgreSQL. The pg package
re-exports them as type aliases, maintaining full backward compatibility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…gQuery

Add support for 5 SQL dialects (PostgreSQL, MySQL, SQLite, DuckDB, BigQuery)
via a pluggable Dialect interface with ~40 methods covering SQL generation
differences. Includes per-dialect type providers with LoadTableSchema support,
shared test infrastructure, integration tests, and dialect-specific index
analysis recommendations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…y dialect

The BigQuery emulator errors on INSTR ("invalid position number") and does not
support the ESCAPE keyword in LIKE patterns. Switch WriteContains to STRPOS and
make WriteLikeEscape a no-op to fix CI integration test failures.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@richardwooding richardwooding merged commit 2ef3182 into main Feb 25, 2026
9 checks passed
@derekperkins
Copy link

Fixes #102

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants