skillfed

ibm-db-sa

SQLAlchemy support for IBM Data Servers

ibm-db-sa v0.4.4 473.1K downloads/30d#6,468 on PyPI45
Permissive license Apache-2.0 Active released

What it is and what it does

IBM_DB_SA is a SQLAlchemy dialect that bridges Python applications to IBM DB2 databases. It translates SQLAlchemy's ORM queries and expression language into DB2-compatible SQL, handling connection management, schema reflection, and type mapping. The adapter supports both TCP/IP and local socket connections and includes built-in logging for debugging connection, reflection, and SQL execution issues.

The package integrates with ibm_db, the underlying DB2 driver, and works with SQLAlchemy versions 0.7.3 through 2.0.x. It supports DB2 on Linux, Unix, Windows, Cloud, ZOS, and iSeries platforms. Developers use it to write database code in Python without writing raw DB2 SQL, leveraging SQLAlchemy's portability and ORM features.

Use it for:

  • Build a web application using SQLAlchemy ORM that persists data to an existing IBM DB2 database without writing raw SQL.
  • Migrate application logic from another database to DB2 by swapping the connection string and dialect.
  • Debug connection and SQL execution issues in a DB2-backed application using the built-in logging parameter.
  • Reflect DB2 schema metadata into Python objects to auto-generate ORM models from an existing database.
  • Write data integration scripts that read from DB2 and transform records using SQLAlchemy's query API.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

SQLAlchemy dialect adapter that enables Python applications to connect to and query IBM DB2 databases using SQLAlchemy's ORM and query interface.

Yes. The adapter is actively maintained, has no known vulnerabilities, installs with low friction, and is the standard way to use SQLAlchemy with DB2. Install it if you need SQLAlchemy ORM support for IBM DB2 databases. The main constraint is that ibm_db must be installed separately and DB2 has some known SQL limitations (documented in the package) that may affect complex queries.

Install

ibm-db-sa on PyPI

pip

pip install ibm-db-sa

uv

uv add ibm-db-sa

poetry

poetry add ibm-db-sa

Installing ibm-db-sa

Before you install

Low friction installation via pip with only two runtime dependencies (sqlalchemy and ibm_db). Repository is actively maintained with recent commits and no known vulnerabilities.

License in practice

Apache-2.0 permissive license allows commercial and private use with minimal restrictions; suitable for most projects.

Quickstart

pip install ibm_db_sa

from sqlalchemy import create_engine

engine = create_engine("db2+ibm_db://user:pass@host:port/database")
connection = engine.connect()
result = connection.execute("SELECT * FROM table")

Requires ibm_db driver 1.0.1 or higher installed separately; SQLAlchemy version between 0.7.3 and 2.0.x; Python 3.8 or newer.

Verify before relying

  • Whether the adapter supports all SQLAlchemy 2.0.x features or has compatibility gaps with newer versions.
  • Performance characteristics and connection pooling behavior under high concurrency.
  • Whether logging to file paths with special characters works reliably on all platforms.

Package facts

License Apache-2.0 (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 2 — sqlalchemy, ibm_db
Maintenance actively maintained — 149 days since the last release
Last repo commit
First released
Downloads 473,124/month — #6,468 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: ibm_db_sa-0.4.4-py3-none-any.whl

Keywords: sqlalchemy, database, interface, IBM, Data, Servers, Db2

Development Status :: 5 - Production/StableIntended Audience :: DevelopersOperating System :: OS IndependentTopic :: Database :: Front-Ends

Tags

sqlalchemy db2 adapteribm db2 python ormsqlalchemy ibm data serversdb2 database driver sqlalchemyibm db2 connection poolsqlalchemy dialect db2
sqlalchemy-dialectdb2-driverorm-adapter

More Front-Ends packages

SQLAlchemy

SQLAlchemy is a Python SQL toolkit and Object…

permissive · top 100 on PyPI

psycopg2-binary

psycopg2-binary is a PostgreSQL database…

copyleft · top 1,000 on PyPI

alembic

Alembic generates and manages database schema…

permissive · top 1,000 on PyPI

weaviate-client

A Python client library for connecting to and…

permissive · top 1,000 on PyPI

databricks-sql-connector

A Python client library that connects to…

permissive · top 1,000 on PyPI

psycopg

Psycopg 3 is a PostgreSQL database adapter for…

copyleft · top 1,000 on PyPI

ibm-db

Python driver for connecting to IBM Db2 for LUW…

permissive · top 5,000 on PyPI

sqlalchemy-ibmi

Provides a SQLAlchemy dialect to connect to Db2…

permissive · top 15,000 on PyPI

sqlalchemy-jdbcapi

SQLAlchemy dialect for JDBC and ODBC database…

permissive · top 15,000 on PyPI

sqlalchemy-databricks

Provides a SQLAlchemy dialect that connects to…

permissive · top 15,000 on PyPI

pybigquery

SQLAlchemy dialect for BigQuery that enables…

permissive · top 15,000 on PyPI

databricks-dbapi

Provides a DBAPI 2.0 connection interface and…

permissive · top 15,000 on PyPI

elasticsearch-dbapi

Provides DBAPI (PEP-249) and SQLAlchemy dialect…

permissive · top 5,000 on PyPI

sqlalchemy-hana

Provides a SQLAlchemy dialect that enables you…

permissive · top 15,000 on PyPI

sqlalchemy_exasol

SQLAlchemy dialect that enables Python…

permissive · top 15,000 on PyPI

sqlalchemy-firebird

Provides a SQLAlchemy 2.0+ dialect for…

permissive · top 15,000 on PyPI