Hi,
I'm pleased to release a new big version (0.6) of GINO - a lightweight ORM built on top of SQLAlchemy core and asyncpg for asyncio.
* BSD license
* The motivation was to make life easier in a context where async DB access was essential
* [NEW] Async SQLAlchemy-alike engine and connection with async dialect API
* Async-friendly objective model for CRUD, a simplified ORM
* Support Sanic and Tornado
* Works with Alembic for migration management
Code example:
from gino import Gino
db = Gino()
class User(db.Model):
__tablename__ = 'users'
id = db.Column(db.Integer(), primary_key=True)
nickname = db.Column(db.Unicode(), default='noname')
async def main():
async with db.with_bind('asyncpg://localhost/gino'):
# Create tables
await db.gino.create_all()
# Create object, `id` is assigned by database
u1 = await User.create(nickname='fantix')
print(u1.id, u1.nickname) # 1 fantix
# Execute complex statement and return command status
status, result = await User.update.values(
nickname='No.' + db.cast(User.id, db.Unicode),
).where(
User.id > 10,
).gino.status()
print(status) # UPDATE 8
# Iterate over the results of a large query in a transaction
async with db.transaction():
async for u in User.query.order_by(User.id).gino.iterate():
print(u.id, u.nickname)
Suggestions and comments are greatly welcome!
BR,
Fantix