01 / DECLARE
Give your data
a shared vocabulary.
Write a Python recipe for packages, tables and columns. Add keys, relationships and calculated values where they belong.
Read a model recipe →A Python database layer
Declare your tables, relationships and calculations once. Use them in queries and business logic, with SQL you can inspect.
# db is ready when the console opens. region = db.table('invc.region') region.insert({ 'code': 'NO', 'name': 'North', }) db.commit()
A plain Python dictionary. An explicit commit.
query = region.query(
columns='$code, $name',
where='$code = :code',
code='NO',
)
rows = query.fetch()
Column references in SQL. Values bound separately.
print(query.sqltext)
SELECT "t0"."code" AS "code",
"t0"."name" AS "name"
FROM "invc"."invc_region" AS "t0"
WHERE ("t0"."code" = :code)
SQLite output from the downloadable example.
[dict(row) for row in rows]
[{'code': 'NO', 'name': 'North'}]
Rows support name and position access. Use dict(row) for a dictionary.
From a definition to an application
A customer's name, an invoice calculation, a relation between tables: give each a place in the model and reuse it.
01 / DECLARE
Write a Python recipe for packages, tables and columns. Add keys, relationships and calculated values where they belong.
Read a model recipe →02 / QUERY
Use $column and @relation.column in expressions. Let Asqueel resolve the model names and bind your values.
03 / WRITE
Insert, update and delete through table objects. Learn the write cycle, hooks and the boundary of each transaction.
Follow a write →Meet Asqueel Migration
A separate, ORM-independent engine compares the database you have with the structure you need. Inspect the generated SQL, apply a reviewed plan and check the result.
Learn by following the code
From your first database object to relations, queries, writes and migrations. Read the course or watch the first three narrated lessons.
Based on the development API. Compatibility notes.
Meet the model. Build your first database object.
Tables, relations, calculated columns and configuration.
Write queries, bind values and choose the result shape.
Understand changes, triggers and relation actions.
Control connections, migrations and application integration.
Compare the concepts and make an informed choice.
Use the CLI to validate your configuration, plan a migration or open a Python console with your database ready.
asqueel check ./console-demo
asqueel db plan ./console-demo
asqueel db apply ./console-demo
asqueel shell ./console-demoThe console is standard Python. Your db object is already available. Build a query, inspect its SQL, fetch rows, or insert a record.
Writes are saved with db.commit(). Leaving the console rolls back pending work.