The Asqueel course
Understand the model.
Follow the code.
Start with one table in the terminal. Then follow an invoicing application through queries, writes and operations, with explanations and code in every scene.
Read all 34 lessons or watch the first three narrated lessons. The course follows the development API. Check compatibility before running examples →
No lessons match. Try a different word.
Module 01
Orientation
Meet the model. Build your first database object.
01Welcome: your first tableInstall Asqueel in a virtual environment, then create, query and change a product table in a Python console. No database files needed.Video + text →02Customers, invoices and relationship pathsImport a product catalogue, customers and dated invoices from CSV. Calculate row totals and read customer and product fields through relationship paths.Video + text →03Filter and sort through relationshipsUse relationship paths in WHERE and ORDER BY, including two-hop filters and descending dates. Select only the fields you need.Video + text →Module 02
The model
Tables, relations, calculated columns and configuration.
04Keys and constraintsDeclare the primary key, multi-column keys, constraints, indexes and extensions, and read the DDL that migration produces.~5 min →05To-one and inverse relationsDeclare relations, read related columns through @ paths, and know what the inverse side of a relation allows.~6 min →06Aggregations over to-many relationsProject aggregates of related rows with .aggr(...), name the results, order collected rows, and know the results on an empty set.~6 min →07virtualRelationDeclare filtered to-many relations with virtualRelation, derive one from another, and link a table without a key relation.~4 min →08Derived columns: aliasColumn, formulaColumnDeclare alias and formula columns, correlate sub-selects with #THIS, bind local values with var_*, and choose which virtual columns * returns.~5 min →09Advanced formulasSupply formulas and sub-selects from Python methods of a table class, and read environment values inside a formula.~4 min →10subQueryColumn and bagItemColumnDeclare collection and scalar sub-query columns, and read single items of an XML document stored in a column.~4 min →11Layered recipesBuild one model from several recipes applied in order, and keep the connection in a deployment recipe.~4 min →12Extending the grammarGive one table a column grammar with extra validated attributes, mounted through x_config.~4 min →13The model hosts external metadataRead attributes of the model from application code and use them to drive an application task.~3 min →Module 03
Reading data
Write queries, bind values and choose the result shape.
14query(...): syntax and clausesWrite a SELECT with table.query() and predict the SQL it produces.~7 min →15Parameters and macrosPass values to a query safely and use the macros #IN_RANGE, #PERIOD, #BAG and #BAGCOLS.~7 min →16Fetch terminalsChoose the terminal that returns the rows in the shape you need.~6 min →17The environmentSet context values for queries and writes, and know when they are read.~5 min →18Row policiesDeclare partition, draft and logical-deletion policies, and control them per query.~5 min →19Locking on read: for_updateLock the rows you read before you change them, on PostgreSQL and on SQLite.~4 min →Module 04
Writing data
Understand changes, triggers and relation actions.
20insert, update, deleteWrite single records with the three table commands and know what each one does with the record, the key and the database values.~7 min →21The order of the write cycleKnow every step that insert, update and delete run, in their order, and how a hook refuses a write or starts another one.~5 min →22Field triggersAttach write logic to a column with the six field-trigger attributes and trigger_table.~4 min →23Relation actions: Python and SQLChoose between the Python actions onDelete/onUpdate and the SQL actions onDelete_sql/onUpdate_sql of a relation, and know when each one runs.~5 min →24Writes without triggers: sql_*, table.lockWrite rows with the sql_* commands and the query terminals, which run only SQL, and lock a table.~4 min →25sys_fields, hierarchical, auto_counterDeclare the three table options that add columns and the field triggers that fill them.~5 min →26recordToUpdate and batchUpdateRead rows with a lock and write them back through the write cycle with two table helpers.~4 min →Module 05
Transactions & operations
Control connections, migrations and application integration.
27Transactions and connectionsComplete every unit of work explicitly, recover from errors, and select independent named connections.~10 min →28Deferred callbacksSchedule work before and after a commit, block a commit on purpose, and recover when a callback fails.~8 min →29Direct SQLExecute SQL text and compiled queries on the unit of work, and know what direct SQL skips.~8 min →30Import and migrationsCreate and evolve the database from the recipe, and read an existing PostgreSQL catalog.~10 min →31The command lineRegister a configuration folder, validate it, plan and apply migrations, and open a console from the terminal.~8 min →32Integration in a host applicationDeclare asqueel databases inside a host configuration, own them by name in a server and its applications, and give every call a clean unit of work.~9 min →33The complete exampleRun the course model end to end, from the recipe to a migrated database, writes, a reading query, an update and a delete.~9 min →Module 06
Other Python ORMs
Compare the concepts and make an informed choice.
34asqueel, SQLAlchemy, Django and PeeweeSee the same tasks in SQLAlchemy ORM, Django and Peewee and in asqueel, and know what asqueel does not provide.~7 min →