Skip to main content

SQLAlchemy adapter for IBM i

Latest version released on PyPi Supported Python Version Badge Documentation Status

The IBM i SQLAlchemy adapter provides an SQLAlchemy interface to Db2 for IBM i.

Please note that this project is still under active development. Please report any bugs in the issue tracker 🚨

Requirements

SQLAlchemy

SQLAlchemy Version Supported Notes
SQLAlchemy 2.0 ✅ Support added in 0.9.4.
SQLAlchemy 1.4 ✅ Support added in 0.9.3.
SQLAlchemy 1.3 ❌ Support removed in 0.9.4.

Python

Python 3.10+ is supported.

IBM i Access ODBC Driver

It is best to use the latest version of the driver, which is currently available in the IBM i Access Client Solutions Application Package 1.1.0.29.

Some options may require certain minimum driver versions to be enabled. Because the driver ignores any unknown options, using them on older driver versions will not cause an error but instead be silently ignored.

Connection Option Required Version
trim_char_fields 1.1.0.25

IBM i

This adapter is only tested against IBM i 7.5 and up. It may support older IBM i releases, but no support is guaranteed.

Installation

pip install sqlalchemy-ibmi

Getting Started

You will need to have the IBM i Access ODBC Driver installed in order to use this adapter. Please read these docs for the simplest way to install for your platform.

import sqlalchemy as sa
engine = sa.create_engine("ibmi://user:password@host.example.com")

cnxn = engine.connect()
metadata = sa.MetaData()
table = sa.Table('table_name', metadata, autoload=True, autoload_with=engine)

query = sa.select([table])

result = cnxn.execute(query)
result = result.fetchall()

# print first entry
print(result[0])

For more details on connection options, check our docs

If you're new to SQLAlchemy, please refer to the SQLAlchemy Unified Tutorial.

Documentation

The documentation for the SQLAlchemy adapter for IBM i can be found at: https://sqlalchemy-ibmi.readthedocs.io/en/latest/

Known Limitations

  1. Non-standard SQL queries are not supported. e.g. "SELECT ? FROM TAB1"
  2. For updations involving primary/foreign key references, the entries should be made in correct order. Integrity check is always on and thus the primary keys referenced by the foreign keys in the referencing tables should always exist in the parent table.
  3. Unique key which contains nullable column not supported
  4. UPDATE CASCADE for foreign keys not supported
  5. DEFERRABLE INITIALLY deferred not supported
  6. Subquery in ON clause of LEFT OUTER JOIN not supported

Contributing to the IBM i SQLAlchemy adapter

Please read the contribution guidelines.

The developer sign-off should include the reference to the DCO in remarks(example below):
DCO 1.1 Signed-off-by: Random J Developer <random@developer.org>

Releasing a New Version

# checkout and pull the latest code from main
git checkout main
git pull

# install package and dependencies
poetry install

# bump to a release version (a tag and commit are made)
poetry run -- bump-my-version bump release

# To skip a release candidate
poetry run -- bump-my-version bump --no-tag --no-commit release
poetry run -- bump-my-version bump --allow-dirty release

# bump to the new dev version (a commit is made)
poetry run -- bump-my-version bump --no-tag patch

# push the new tag and commits
git push origin main --tags

License

Apache 2.0

Credits

  • ibm_db_sa for SQLAlchemy was first produced by IBM Inc., targeting version 0.4.
  • The library was ported for version 0.6 and 0.7 by Jaimy Azle.
  • Port for version 0.8 and modernization of test suite by Mike Bayer.
  • Port for sqlalchemy-ibmi by Naveen Ram/Korinne Adler.

Metadata

Release files for sqlalchemy-ibmi 0.9.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sqlalchemy-ibmi 0.9.4
File Size Uploaded Provenance Actions
sqlalchemy_ibmi-0.9.4.tar.gz 31.4 kB With provenance Details for sqlalchemy_ibmi-0.9.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sqlalchemy-ibmi 0.9.4
File Interpreter ABI Platform Actions
sqlalchemy_ibmi-0.9.4-py3-none-any.whl Python 3 none any Details for sqlalchemy_ibmi-0.9.4-py3-none-any.whl

Total release size: 57.2 kB

Release files / sqlalchemy_ibmi-0.9.4.tar.gz

Download URL sqlalchemy_ibmi-0.9.4.tar.gz
Size 31.4 kB
Tags Source
SHA-256 checksum
How to use checksums
65df4d6ff1aba5ffc2d7cf8aba3557ed099d69e7cdf0cefeee9e6810789be621
BLAKE2b-256 checksum
How to use checksums
0e2d759adcc06c3c5ffccffc3de92ac48c516ca43f2d8540d893de4fc87c7605
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 9, 2026.

Transparency log

Release files / sqlalchemy_ibmi-0.9.4-py3-none-any.whl

Download URL sqlalchemy_ibmi-0.9.4-py3-none-any.whl
Size 25.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bb2f7e8b55e149368e6ca888eac94cbf031fea1df853c58865ac259bd2b587c7
BLAKE2b-256 checksum
How to use checksums
b08885d0e56283a703185eebd26d769471555cda8e5602f4257077c196fde311
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 9, 2026.

Transparency log

Security for sqlalchemy-ibmi 0.9.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sqlalchemy_ibmi-0.9.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 9, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page