Skip to main content

asyncio query generator

Project description


simple query generator for modern python

build status code coverage version license code style


aql is a simple, modern, and composable query builder, with support for asynchronous execution of queries against multiple database backends using a unified API. aql uses modern, type annotated data structures for both table definitions and queries.

Define tables:

class Object:
    id: PrimaryKey[AutoIncrement[int]]
    name: Unique[str]
    description: text
    created: datetime

Build queries:

query = (
    .where( >= 25)

sql, params = SqlEngine.prepare(query)
# "select * from `objects` where `id` >= ? order by `name` asc limit 5", (25)

Execute queries:

async with connect(...) as db:
    cursor = db.execute( < 100))
    async for row in cursor:
        print(f"{} {} {row.description}")

Simple actions:

async with connect(...) as db:
    rows = await db.get(Object, == 100)
    rows[0].description += "updated"

    await db.modify(Object, rows)


aql is copyright John Reese, and licensed under the MIT license. I am providing code in this repository to you under an open source license. This is my personal repository; the license you receive to my code is from me and not from my employer. See the LICENSE file for details.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for aql, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size aql-0.1.1.tar.gz (15.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page