Skip to content

pyaltibase

Unofficial Python DB-API 2.0 connector for Altibase.

Key features

  • Python DB-API 2.0-compatible interface for Altibase
  • Direct host/port and DSN-based connection support
  • Package-owned exception hierarchy and type constructors
  • Docker-friendly testing workflow for unit and end-to-end coverage

Quick install

pip install pyaltibase

Quick connect example

import pyaltibase

with pyaltibase.connect(
    host="localhost",
    port=20300,
    database="test",
    user="sys",
    password="manager",
) as conn:
    cursor = conn.cursor()
    cursor.execute("SELECT 1")
    print(cursor.fetchall())

Documentation

Feature highlights

  • DB-API 2.0 constants exported at module root (apilevel, threadsafety, paramstyle)
  • Unified exception hierarchy independent from backend exception classes
  • Connection-string assembly separated in protocol layer for testability
  • Explicit connection controls for encoding (nls_use) and LOB compatibility (long_data_compat)

Default connection values

host="localhost", port=20300, and user="sys" are used unless you override them.

Prefer context managers

Using with pyaltibase.connect(...) as conn: ensures commit/rollback and close handling is consistent.

How requests flow

mermaid flowchart LR A[Application] --> B[pyaltibase.connect] B --> C[ConnectionConfig] C --> D[build_connection_string] D --> E[pyodbc.connect] E --> F[Connection.cursor] F --> G[Cursor.execute/fetch] G --> H[Result tuples]

Suggested reading path

  1. Installation
  2. Quick Start
  3. Connection Guide
  4. API Reference
  5. Type Mapping
  6. Error Handling
  7. FAQ