Architecture¶
Layers¶
- Application code calls
pyaltibase.connect(...). pyaltibase.connection.Connectionbuilds an Altibase ODBC connection string.pyodbcopens the real database connection.pyaltibase.cursor.Cursordelegates execute and fetch operations to the native cursor.- Backend exceptions are mapped into package-owned DB-API exception classes.
Design choices¶
qmarkparameter style matchespyodbcand DB-API 2.0 expectations.- Package-owned exception classes keep the public API stable.
- Connection-string creation is isolated in
protocol.pyso backend behavior is testable. - Unit tests use a fake
pyodbcbackend; e2e tests validate the real driver path.
End-to-end runtime view¶
```mermaid sequenceDiagram participant App as Application participant API as pyaltibase.connect participant Conn as Connection participant Proto as protocol.build_connection_string participant ODBC as pyodbc participant Cur as Cursor
App->>API: connect(...)
API->>Conn: create ConnectionConfig
Conn->>Proto: build_connection_string(config)
Proto-->>Conn: ODBC string
Conn->>ODBC: connect(conn_str, autocommit, timeout)
ODBC-->>Conn: native connection
App->>Conn: cursor()
Conn->>ODBC: native cursor()
Conn-->>Cur: wrapped cursor
App->>Cur: execute/fetch
```
Error translation boundary¶
mermaid
flowchart LR
A[pyodbc Exception] --> B[_map_backend_error]
B --> C[pyaltibase Error subclass]
C --> D[Application catches stable public exceptions]
Stability contract
Application code should catch pyaltibase exceptions, not backend-specific exceptions,
to keep behavior stable when backend details evolve.
Extensibility
New connection attributes can be added without changing method signatures by routing through **kwargs into ConnectionConfig.options.