A high-performance async Python ORM with Go backend for maximum database performance. Features connection pooling, query caching, migrations, profiling, and comprehensive validation.
Project description
KaironDB
The Async Python ORM that doesn't sacrifice performance.
KaironDB is a modern database access library built on a unique hybrid architecture: an elegant and declarative Python API that communicates with a high-performance DLL written in Go.
Stop choosing between the ease of use of an ORM and the speed of a low-level driver. With KaironDB, you get both.
✨ Key Advantages
Truly Asynchronous
Built from the ground up for async/await. Run hundreds of queries in parallel with asyncio.gather and watch your application fly, ideal for frameworks like FastAPI.
Extreme Performance
Thanks to the Go backend and automatic Connection Pooling, KaironDB minimizes Python's overhead to deliver performance that surpasses traditional solutions in high-concurrency scenarios.
Declarative & Safe API
Define your tables as intuitive Python classes. KaironDB provides automatic data validation, ensuring the integrity of your data before it even hits the database.
Powerful Querying
Forget long SQL strings. Build complex queries with AND (&) and OR (|) programmatically using Q Objects and dynamic filters like __gt, __like, and __in.
Multi-DB Support
Write your code once and run it on PostgreSQL, SQL Server, MySQL, and SQLite without changes.
🚀 Installation
Available directly on PyPI. Install with a simple pip command:
pip install kairondb
⚡ Quickstart Guide
1. Define Your Model
Describe your table using Python classes.
from kairondb import Model, IntegerField, StringField
class User(Model):
_table_name = "users"
id = IntegerField(primary_key=True)
name = StringField(required=True, max_length=100)
status = StringField(default='active')
2. Connect and Run an Async Query
All database interaction is done asynchronously.
import asyncio
from kairondb import SQLBridge, Model
async def main():
bridge = SQLBridge(
driver="postgres",
server="localhost",
db_name="mydb",
user="myuser",
password="mypassword"
)
Model.set_bridge(bridge)
active_users = await User.select(where={'status': 'active'})
print(active_users)
await bridge.close()
if __name__ == "__main__":
asyncio.run(main())
📖 Advanced Usage
Complex Queries with Q Objects
from kairondb import Q
query = Q(status='active') & (Q(age__lt=25) | Q(name__like='A%'))
results = await User.select(where=query)
Concurrent Execution
tasks = [User.select(where={'id': i}) for i in range(1, 101)]
results = await asyncio.gather(*tasks)
Atomic Transactions
try:
async with bridge.transaction() as tx:
accounts_model = Model(tx, "Accounts")
await accounts_model.exec("UPDATE Accounts SET balance = balance - 100 WHERE id = 1")
await accounts_model.exec("UPDATE Accounts SET balance = balance + 100 WHERE id = 2")
print("Transfer successful!")
except Exception as e:
print(f"Transaction failed and was rolled back: {e}")
❤️ Contributing
KaironDB is an open-source project, and all help is welcome! If you find a bug, have a suggestion, or want to contribute code, please open an "Issue" or a "Pull Request" on our GitHub repository.
📄 License
Distributed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kairondb-1.0.1.tar.gz.
File metadata
- Download URL: kairondb-1.0.1.tar.gz
- Upload date:
- Size: 10.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d747e612197dc03678ca47c459b3dd6b7adf49e664a26191bb5fc1fe438f395d
|
|
| MD5 |
230e229af5567aae2b5d14bd4118087b
|
|
| BLAKE2b-256 |
4390fcd64032002e3867b14df9579fb1a5abd2d7c166d63f4ea7fcb9458dd76c
|
File details
Details for the file kairondb-1.0.1-py3-none-any.whl.
File metadata
- Download URL: kairondb-1.0.1-py3-none-any.whl
- Upload date:
- Size: 7.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13237932a9de95bba6302388dbe5bef246c06c1135a4708d5f01b4a012d36d78
|
|
| MD5 |
8388a589fcaf77b2855485c9ca1d5bdc
|
|
| BLAKE2b-256 |
35ec7cd90ac220e9d20e622c2d9d52a7f6f13d71084c419de9439950e3756544
|