Skip to main content

Asqueel

PyPI Tests Codecov Documentation Python License

Asqueel

Asqueel is a Python database layer that makes your application's data model reusable across queries, business logic and user interfaces. Declare tables, relationships, calculated fields and UI metadata together, then work with that model through a live db object.

Asqueel is the port of GenroPy's SQL layer to a standalone library.

It addresses a common source of duplication in database applications: the same relationship, calculation or field description gets rewritten in queries, service code and screens. In Asqueel, a related customer name or an invoice calculation can be defined once as a model column and reused wherever you query it. UI code can read the field's label and formatting from the same model. SQL remains available for expressions; Asqueel resolves model names and relation paths and binds query parameters.

Asqueel brings Genropy's approach to database applications into a standalone library. The current checkout supports PostgreSQL and SQLite, with explicit writes and transaction completion. Start with What is Asqueel? for the approach and an example. The manual also covers planned capabilities; Current status identifies what works today and what remains to be implemented.

The alternative hierarchical model supports SELECT compilation and fetch/count execution, including supported to-one relations, formulas, subqueries and filters. It returns mutable Toolbox NamedList rows on PostgreSQL and SQLite; see the scope and legacy comparison. The default renderer is unchanged; to-many operations still have no handlers.

Install

Version 0.6.0 completes native package configuration → live model objects → migration JSON, verified on 74 test_invoice_pg tables across sys, adm and invc. See the native source example and release notes for the delivered scope and deferred compiler/runtime behavior.

python -m pip install "asqueel[postgresql]"

Use asqueel for model building and offline compilation only. Add the migration extra to use the separate schema migration integration. From a checkout, run python -m pip install -e ".[postgresql]" in the repository root.

Build an application database

Declare the model and connection configuration in one recipe:

from asqueel import SqlDatabaseConfig, AsqueelDb


class Shop(SqlDatabaseConfig):
    def main(self, root):
        db = root.db("shop", conninfo="dbname=shop")
        customer = db.schemas().schema("sales").tables().table("customer", pkey="id")
        columns = customer.columns()
        columns.column("id", dtype="L")
        columns.column("name", dtype="T", x_ui_label="Customer name")


db = AsqueelDb(Shop)
customer = db.table("sales.customer")
query = customer.query(
    columns="$id, $name", where="$id >= :minimum_id",
    minimum_id=1, order_by="$id",
)
print(query.sqltext)  # Compiles without opening a connection.
db.closeConnection()

Against an existing sales.customer table, call query.fetch() to get a list of mutable Toolbox NamedList rows (name and position access). Table writes and reads share the selected thread-local connection, opened lazily. Use db.commit() and db.rollback(). Select a named connection with db.tempEnv(connectionName=...). db.closeConnection() rolls back pending work and keeps the database usable; with session(db): calls it at exit.

Construction does not connect or create tables. The runnable quickstart includes explicit disposable schema setup and cleanup. Configuration explains layered recipes and live table objects. The separate compiler and low-level runtime remain available for advanced integrations.

Query expressions are application code; pass external values through parameters rather than SQL interpolation.

Configure, migrate and explore a complete example

The two-schema example separates configuration, schemas, table declarations and business logic. It includes users/access logs and customers/products/invoices/rows, with explicit imports and EnvResolver connection settings.

From this source checkout:

python -m pip install -e ".[postgresql,migration]"
asqueel register gestionale ./examples/two_schemas
asqueel check gestionale
asqueel db plan gestionale
asqueel db apply gestionale
asqueel shell gestionale

Set the example's PG* environment variables for your PostgreSQL server before plan/apply; the database account must have the required privileges. check is offline. The registry in ~/.asqueel stores the folder path, not credentials. The console provides db; the same name works with AsqueelDb("gestionale") in Python. See the complete walkthrough and CLI reference for setup, migrations and transaction behavior.

Learn and use Asqueel

Start with What is Asqueel? and the object model, run the quickstart, then follow the customers and invoices tutorial. The tutorial includes a complete runnable script with assertions, transaction examples and disposable-schema cleanup.

You want to… Read
Run the two-schema example, migrate it and open a console Complete example and CLI
Configure an application and render live objects Configuration
Declare names, relations, aliases and UI metadata Models
Read data or load exactly one record Queries
Insert, update or delete Writes and transactions
Add business behavior Table hooks
Define computed values and correlated subqueries Formulas
Scope data by organization, draft or deletion state Environment and row policies
Start from an existing database or manage its schema Importing and migrations
Come from Genropy For Genropy users, including agreed differences
Come from SQLAlchemy For SQLAlchemy users
Come from Django For Django users
Come from Peewee For Peewee users
Look up a call or diagnose a problem API cheat sheet and troubleshooting

For advanced integration, see cascading grammars, the compiler, low-level execution and adapters.

The public Sphinx site contains these English guides and the API reference. To build it locally:

python -m pip install -e ".[docs]"
python -m sphinx -W --keep-going -b html docs docs/_build/html

Open docs/_build/html/index.html. Internal design notes remain in the repository and are excluded from the public documentation build.

Development checkout

For development with the migration integration, install its checkout and Asqueel with the development dependencies (replace the example path with your checkout):

pip install -e "../asqueel-migration[postgresql,validation]" -e ".[dev]"

License

Apache License 2.0 — Copyright Softwell S.r.l.

SQLite configuration and runtime limitations are described in the SQLite guide.

Metadata

Release files for asqueel 0.6.0

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

Source distribution (sdist)

Source distribution for asqueel 0.6.0
File Size Uploaded Provenance Actions
asqueel-0.6.0.tar.gz 6.9 MB With provenance Details for asqueel-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for asqueel 0.6.0
File Interpreter ABI Platform Actions
asqueel-0.6.0-py3-none-any.whl Python 3 none any Details for asqueel-0.6.0-py3-none-any.whl

Total release size: 7.1 MB

Release files / asqueel-0.6.0.tar.gz

Download URL asqueel-0.6.0.tar.gz
Size 6.9 MB
Tags Source
SHA-256 checksum
How to use checksums
4b132919a482d2267d21bfbadf2e6a61e863eb7e2f2a6be259ee0915b0794fed
BLAKE2b-256 checksum
How to use checksums
bcfd46a2dbf2634ee5843ed166b6f43c59439d1bb212f5412f5c748c9939ed71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 20, 2026.

Transparency log

Release files / asqueel-0.6.0-py3-none-any.whl

Download URL asqueel-0.6.0-py3-none-any.whl
Size 192.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d192b8d6d54094a19b48595b7a1b72a7284d6086884aba8ee79719d1535a8e0
BLAKE2b-256 checksum
How to use checksums
932a41743deee38aeb41368158497c18a7d62e6839e6e9913468c76c9284542d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 20, 2026.

Transparency log

Security for asqueel 0.6.0

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 asqueel-0.6.0.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 Oct 20, 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