Skip to content

SQL Server driver — implementation roadmap & call for contributors #150

@debba

Description

@debba

SQL Server driver — implementation roadmap & call for contributors

Status

Phase 1 is done on feat/sql-server. Clean-room tiberius + deadpool, peer to MySQL / PostgreSQL / SQLite. Not merged to main. Not in any released build. The branch squashes into main when Phase 2 closes via #149.

Phase 2 (editing + TLS + composite keys) is open for contribution. Phase 3 (DDL + EXPLAIN + Azure AD) is on the roadmap.

471 Rust tests pass, zero regressions on the existing drivers.

Contributors: branch off feat/sql-server, not main. Target your PR at feat/sql-server, not main.

Phase 1 — done on feat/sql-server

  • Driver registered in src-tauri/src/lib.rs, selectable from the Connection modal
  • readonly: true manifest (INSERT / UPDATE / DELETE hidden in UI during the preview)
  • Pool built on deadpool + a custom tiberius::Manager (src-tauri/src/drivers/sqlserver/pool.rs)
  • Schema discovery via sys.* + INFORMATION_SCHEMA.* (tables / columns / FK / indexes / views / routines)
  • execute_query with dialect-aware pagination (PaginationDialect::OffsetFetch, added to drivers/common/query.rs)
  • Type extraction for 20+ SQL Server types (bit, int family, float family, decimal / numeric / money, uniqueidentifier, temporal family, char / varchar / nvarchar / xml, binary base64, UDT / SSVariant fallback)
  • Runtime version detection (drivers/sqlserver/version.rs) with a conservative default major = 14 (SQL Server 2017) and feature gates for 2012 (OFFSET/FETCH) and 2017 (STRING_AGG)
  • ER-diagram batch helpers (get_all_columns_batch / get_all_foreign_keys_batch / get_schema_snapshot)

Phase 2 — open for contribution

Phase 3 — roadmap

  • DDL generation (sp_rename, IDENTITY(1,1), default-constraint DROP+ADD dance)
  • XML execution-plan parser (SHOWPLAN_XML)
  • Triggers / computed columns / extended properties metadata
  • Azure AD authentication (AuthMethod::AADToken)
  • Windows Integrated authentication (#[cfg(windows)])

Ground rules

  • Clean-room implementation. Do not copy GPL-licensed code from other open source database clients. Tabularis stays Apache-2.0.
  • Zero breaking changes for MySQL / Postgres / SQLite drivers or for saved connections. New model fields land as Option<T> with #[serde(default)] and skip_serializing_if.
  • Utilities ship with unit tests in the same PR. Pure functions — formatters, parsers, query builders, normalizers, SQL-string constants — get co-located #[cfg(test)] mod tests { ... } coverage. No exceptions.
  • Conservative version fallback. When runtime detection can't determine the server major version, default to 14 (SQL Server 2017) — modern enough to unlock OFFSET/FETCH + STRING_AGG, old enough to cover the bulk of real-world installations.

Architecture primer

The driver lives in src-tauri/src/drivers/sqlserver/ on feat/sql-server:

File Purpose
pool.rs Custom deadpool::managed::Manager wrapping tiberius::Client over tokio TCP via tokio-util::compat
helpers.rs bracket_quote / quote_identifier / qualify — all pure, all tested
version.rs SERVERPROPERTY parsing + feature gates (supports_offset_fetch, supports_string_agg, supports_drop_if_exists)
introspection.rs sys.* + INFORMATION_SCHEMA.* queries + pure build_table_column / build_foreign_key
extract/mod.rs ColumnType-keyed dispatcher returning serde_json::Value
extract/temporal.rs Pure chrono formatters for date / time / datetime / datetimeoffset

The pagination split lives in src-tauri/src/drivers/common/query.rs::PaginationDialect (shared with MySQL / Postgres / SQLite via a legacy passthrough).

Getting started

  1. Spin up a local server:
    docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=Strong!Pass123' \
      -p 1433:1433 mcr.microsoft.com/mssql/server:2022-latest
  2. Clone Tabularis, switch to feat/sql-server (the driver isn't on main), confirm the baseline:
    git clone https://github.com/TabularisDB/tabularis.git
    cd tabularis
    git checkout feat/sql-server
    cargo test --lib          # 471 tests should pass
    npm run typecheck
  3. Pick a sub-issue below (look for good first issue and help wanted labels) and say hi in the comments before you start.
  4. Branch off feat/sql-server, open a PR targeting feat/sql-server, reference this epic. Reviewers will check the "utilities with tests" invariant during review.

Questions, design pushback, alternative approaches → comment here or open a GitHub Discussion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is neededroadmapPart of the product roadmapsql-serverSQL Server driver

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions