Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Database

SQL Server Connection

PropertyValue
EngineSQL Server 2025
DriverTiberius (pure Rust TDS protocol implementation)
ProtocolTDS 7.3
ORMNone — hand-written SQL with parameterized queries
AsyncFully async via Tokio

Multi-Region Architecture

Efision supports multiple database regions, each representing a separate business entity:

RegionFlagEnvironment Variables
Australia-r auDB_AU_HOST, DB_AU_PORT, DB_AU_NAME, DB_AU_USER, DB_AU_PASSWORD
United Kingdom-r ukDB_UK_*
United States-r usDB_US_*
Demo-r demoDB_DEMO_*

Region resolution happens in crates/core/src/infrastructure/config.rs. The CLI’s --region flag selects which set of environment variables to use for the database connection.

Why No ORM?

Efision uses hand-written SQL instead of an ORM for several reasons:

  1. Legacy schema — 305 tables with non-standard naming conventions that don’t map cleanly to ORM patterns
  2. Performance — direct TDS protocol access avoids ORM overhead
  3. Complex queries — stored procedures, cross-table updates, and business-specific queries are easier to express in raw SQL
  4. Gradual migration — only the tables needed for current features are mapped as entities

Schema

The full database schema (305 tables) is available at docs/schema.sql in the repository.

Why Tiberius?

FeatureTiberiuspyodbc (Python)
DependenciesPure Rust (no C deps)Requires ODBC driver
AsyncNative async (Tokio)No native async
Performance~5-7x fasterBaseline
Memory~10 MB~50 MB
DeploymentSingle binaryPython runtime + driver
PlatformmacOS, Linux, WindowsSame

See SQL Server Compatibility for detailed driver research.