Skip to content

Connections

AMSDAL uses two types of database connections:

  • State connections store the current version of each object. Records can be created, updated, and deleted — the standard approach for most applications.
  • Historical connections store every version of every object immutably. This enables full data lineage, time-travel queries, and rollback.

Note

A typical AMSDAL application uses a state connection for day-to-day operations and a historical (lakehouse) connection for audit trail and version history.

Built-in Connections

Data store State Historical Config alias
SQLite sqlite / sqlite-historical
PostgreSQL postgres-state / postgres-historical

Async variants are also available: sqlite-async, sqlite-historical-async, postgres-state-async, postgres-historical-async.

Multiple Connections

AMSDAL supports an unlimited number of connections in a single application. You can route different models to different databases:

resources_config:
  repository:
    default: main-db
    models:
      analytics: analytics-db
      user: users-db

See Configuration for the full connection setup.

Connection Interfaces

All connections implement one of two base classes:

  • StateConnectionBase — for state (mutable) connections
  • HistoricalConnectionBase — for historical (immutable) connections

You can implement custom connections by extending these base classes.