sqlalchemy-firebird-async
Asynchronous Firebird dialect for SQLAlchemy.
This library provides proper asyncio support for Firebird databases in SQLAlchemy 2.0+, allowing you to write fully asynchronous code using modern Python patterns.
It supports three underlying drivers:
fdb(Legacy) - Runs the official C-based driver in a thread pool. Fast and stable.firebird-driver(Modern) - Official driver for Firebird 3+. Also threaded (run_in_executor).firebirdsql- Pure Python asyncio driver. Currently experimental due to upstream issues.
📦 Installation
Install using pip:
# Install with the FDB driver (Legacy, Stable)
pip install "sqlalchemy-firebird-async[fdb]"
# Install with the Firebird Driver (Modern, FB 3.0+)
pip install "sqlalchemy-firebird-async[firebird-driver]"
# Install with pure python driver (Experimental)
pip install "sqlalchemy-firebird-async[firebirdsql]"
# Note: For correct async behavior with firebirdsql, you might need a patched version:
# pip install git+https://github.com/attid/pyfirebirdsql.git
🚀 Quick Start
1. Using FDB Driver (Legacy)
This dialect runs the legacy fdb driver in a thread pool.
URL Scheme: firebird+fdb_async://
import asyncio
from sqlalchemy.ext.asyncio import create_async_engine, async_sessionmaker
from sqlalchemy import text
async def main():
# Format: firebird+fdb_async://user:password@host:port/path/to/db
dsn = "firebird+fdb_async://sysdba:masterkey@localhost:3050//firebird/data/employee.fdb"
engine = create_async_engine(dsn, echo=True)
# ... usage is identical for all drivers
2. Using Firebird Driver (Modern)
This dialect uses the modern firebird-driver package (the official driver for Firebird 3.0+), running in a thread pool. It requires Firebird 3.0 or higher.
URL Scheme: firebird+firebird_async://
engine = create_async_engine(
"firebird+firebird_async://sysdba:masterkey@localhost:3050//firebird/data/employee.fdb?charset=UTF8"
)
3. Using Native Async Driver (firebirdsql)
Warning: The upstream firebirdsql driver currently has issues with asyncio compatibility (bugs causing crashes or incorrect behavior).
A patched fork is available at attid/pyfirebirdsql, which fixes the async logic but currently exhibits significantly lower performance (approx. 4x slower than fdb).
URL Scheme: firebird+firebirdsql_async://
engine = create_async_engine(
"firebird+firebirdsql_async://sysdba:masterkey@localhost:3050//firebird/data/employee.fdb"
)
📊 Performance Comparison
We compared both drivers executing 5000 queries in 8 concurrent tasks (4 raw SQL + 4 ORM).
| Metric | fdb (Threaded) 🏆 | firebirdsql (Patched) | Difference |
|---|---|---|---|
| Total Time | 4.53s | 116.20s | ~25x slower |
| Avg Query Time (ORM) | 2.54s | 114.43s | ~45x slower |
| Avg Query Time (Raw) | 4.44s | 116.14s | ~26x slower |
| Parallel Ratio | 6.16x | 7.94x | - |
Benchmark details: 8 concurrent workers, 5000 rows each, total 40k rows.
As seen above, fdb in a thread pool is significantly faster for high-load scenarios.
🔌 Connection String Guide
| Driver | Protocol | URL Scheme |
|---|---|---|
| fdb (Legacy) | TCP/IP | firebird+fdb_async://user:pass@host:port/db_path |
| firebird-driver (Modern) | TCP/IP | firebird+firebird_async://user:pass@host:port/db_path |
| firebirdsql | TCP/IP | firebird+firebirdsql_async://user:pass@host:port/db_path |
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for sqlalchemy-firebird-async 0.2.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sqlalchemy_firebird_async-0.2.5.tar.gz | 21.3 kB | Without provenance | Details for sqlalchemy_firebird_async-0.2.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sqlalchemy_firebird_async-0.2.5-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for sqlalchemy_firebird_async-0.2.5-py2.py3-none-any.whl |
Total release size: 36.9 kB
Release files / sqlalchemy_firebird_async-0.2.5.tar.gz
| Download URL | sqlalchemy_firebird_async-0.2.5.tar.gz |
|---|---|
| Size | 21.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bfac1352e69b921866b465858d714ba76312650493eb37865a913486890e01d1
|
|
BLAKE2b-256 checksum How to use checksums |
e75dc8bd506c3fee1a0b46bc78d9ee4b85d207b389825e7aea1f217a586673bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.5 {"installer":{"name":"uv","version":"0.10.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / sqlalchemy_firebird_async-0.2.5-py2.py3-none-any.whl
| Download URL | sqlalchemy_firebird_async-0.2.5-py2.py3-none-any.whl |
|---|---|
| Size | 15.6 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
bc1d79e4c7e7c94e5c62443e6adc61d41a4d7448e5b0767f71ebe380ea28d09f
|
|
BLAKE2b-256 checksum How to use checksums |
a5b93fa1da10a2ccbb8c11f1f1021e688d6a6d39ae1ba40e7fa565c674c6d81d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.5 {"installer":{"name":"uv","version":"0.10.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for sqlalchemy-firebird-async 0.2.5
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.