Changelog
0.1.2 - 2026-11-24
- Test mode (
TestCase): Django code that catches a statement the database refuses inside its ownatomic()block while slots with connection options use the test's connection no longer breaks the test's transaction. Before a statement of Django code in a failed transaction (a rollback) no options are set; the options of Django code are set right before its next statement, also after the last slot closes. The guard of Django code's statements stays installed until the test ends (SharedTestConnection.end()). - Test mode (
TestCase): the statements that set connection options on the test's connection (SAVEPOINT adorm_options,SET LOCAL) stay out of Django's query log, soassertNumQueries()andCaptureQueriesContextcount only the test's own statements.
0.1.1 - 2026-11-24
- Connection profile hook
check_operation(operation, session)(ConnectionProfile.check_operation, an import path in theADORMsetting; typeadorm.settings.OperationCheck): a plain function called for every operation of the profile's sessions, in the awaiting task's context, before the operation reaches a slot or a transaction and before any I/O, on every bundled driver and insideatomic()blocks. An exception it raises propagates unchanged and nothing reaches the database; inside a block, the block stays usable.adorm.executor.Pool.check()runs it. The pool's start-up schema check does not. Operation.models: the labels of the models whose tables an operation reads or writes (relation paths, subqueries, many-to-many through tables,select_related(), parent tables of multi-table inheritance, concrete models of proxies, the cascades of a delete),Nonewhen adorm cannot know them (driver methods, third-party operations, a path through a relation the target ORM knows and adorm does not).ModelMeta.delete_models: the models deleting rows of a model reads or writes, by Django's deletion collector (on_delete), written byadorm generate(adorm.codegen.django.delete_models_of(),ModelSpec.delete_models). Generate the models again to get it; without itOperation.modelsof a delete isNone.- Tenant relations: a read-only reverse relation from a shared model to a model whose rows live in several tenant schemas. Declared on the Django model with
adorm.contrib.django.TenantRelation(to, field=, schema=, tenant_models=, session=), which adds no column, migration or system check;adorm generatechecks it and emitsadorm.TenantRelation(RelationSpeckind"tenant"; the schema path, or an expression ofF,Value,Concat,Lower,Upper,Replace,Left,Right,LPad,CoalesceandCast).get_tenant_relations(). adorm.TenantQuerySet, what a tenant relation returns on an instance: oneSelectlists the instance's schemas, one statement (UNION ALLof the schemas' tables) reads the rows, withfilter(),exclude(),annotate(),order_by(), slicing,values(),values_list(),only(),defer(),select_related(),first(),last(),get(),count(),exists(),aggregate()andschemas()across all schemas. Writes through the relation,distinct(),prefetch_related(),select_for_update()and set operations raiseNotSupportedError.- An instance read in a tenant schema keeps it (
ModelState.tenant_schema,Model.from_row(tenant_schema=)): itssave(),delete(),full_clean(),refresh_from_db()and loads of relations to the schema's models run in that schema, on any session. Instances equal and hash by schema too when they have one. adorm.TenantSchemaandQuery.in_tenant_schema(schema, models): the tables of the models qualify with the schema wherever the query reads them, on the Django driver for every Django backend (the backend'squote_name()) and on the native PostgreSQL driver (adorm.drivers.django.tenants).Save,DeleteInstanceandFullCleantaketenant_schema; the query writes, andcreate(),bulk_create()andcreate_from_parent()of a query set, refuse a query in a tenant schema. Constructclause.tenant_schema.Operation.schemasandOperation.unqualified_models: the schemas an operation names and the models whose tables it leaves to the search path. The schema-per-tenant how-to'scheck_operationreadsunqualified_models.aggregate()over a set operation (Aggregateof a combined query): the expressions aggregate the combined rows, named by their columns. Constructaggregate.combined.- How-to schema per tenant: the tenant in the session name, refusing tenant tables without a tenant, and reading across tenants.
0.1.0 - 2026-11-20
- Breaking: the native PostgreSQL driver refuses a write Django would send
pre_save,post_save,pre_deleteorpost_deletefor, withNotSupportedErrorbefore anything is written, when the signal has a live receiver for the sender. Such a write used to run without the receivers. List the receivers whose work the application does itself in the new profile settingConnectionProfile.covered_receivers(dotted paths,module.qualname), or write the model on a Django driver profile, where the receivers run. A model with delete receivers is not fast-deleted. - Breaking:
build_lookup()keepsexactandiexactwithNoneasExact/IExactnodes (rhs_accepts_none) instead of buildingIsNull. On a field, relation or expression it still matches NULL; at a key inside a JSON field (address__note=None) it matches JSONnull, as in Django.address=Noneon the JSON field itself matches SQL NULL. - Transforms in field paths:
year,iso_year,quarter,month,week,week_day,iso_week_day,day,hour,minute,second,dateandtime, chained, in lookup keys,F(),values(),values_list(),order_by(),distinct()and grouping, computed in the current time zone for a datetime.register_transform(),Transform,TRANSFORMS; construct namestransform.<name>. - JSON fields: list indexes in field paths (
tags__0) and the lookupscontained_by,has_key,has_keysandhas_any_keys. - Database functions:
Cast,Collate,Greatest,Least,NullIf,JSONArray,JSONObject,Extractand theExtract*functions, the math functions (AbstoSqrt,Pi,Random), the text functions (Chr,Ord,Left,Right,LPad,RPad,LTrim,RTrim,Trim,Repeat,Replace,Reverse,StrIndex,Substr), the hash functions (MD5,SHA1toSHA512),UUID4andUUID7. - Own expressions: a
Func,LookuporTransformsubclass declares its SQL infunction,template(andarg_joiner) ortemplates, one template per database vendor; the Django driver and the native PostgreSQL driver render it and declare its construct name on the vendors it has a template for, also for classes defined after the driver was imported.adorm.drivers.django.register_translation()registers a translation into a Django expression of a function, lookup or transform for both drivers;register_sqlite_function()registers a Python function on the Django driver's SQLite connections.adorm.query.sql_constructs(),adorm.drivers.Constructs. Recipe: own expressions. UUID4andUUID7with Django 5.2 and 6: Django's function where Django and the database have it, elseGEN_RANDOM_UUID()and PostgreSQL 18'sUUIDV7()on PostgreSQL (UUID7is refused before 18) and SQLite functions of adorm's, generated in Python, on SQLite.adorm.uuid7(): a version 7 UUID generated in Python (uuid.uuid7()from Python 3.14 on), e.g. as a field default (default=adorm.uuid7).- A transform's
applies_to()andoutput_type()get the field's type withoutAnnotatedandOptional. Concatwithoutoutput_typeconcatenates arguments of different text fields on the Django-based drivers.Model.refresh_from_db(fields=None): reloads the loaded fields, or the named ones, and clears cached relations and prefetched rows, as Django does.- An unknown last segment of a key that names its lookup (
joined__yeer__exact) is reported as an unsupported transform, asresolve_lookup()does.orm_path()takesimplicit. - The asyncpg compiler writes the time zone name and the
DATE_TRUNCprecision into the SQL as literals, so adistinct()on a datetime transform matches itsorder_by().
0.0.5 - 2026-11-19
- Connection option
search_path(PostgreSQL'ssearch_path): a list or tuple of schema names, set likerolefrom the profile, the session, aconnection_options()block or anon_acquirehook. Recipe: schema per tenant. ConnectionProfile.content_types_key(profile, session): splits the profile's content type cache, e.g. per tenant when each tenant's schema has its own content type table.- A threaded connection asks
idle_fileno()only onceconnect_sync()has succeeded, not before it runs or after it fails.
0.0.4 - 2026-11-18
adorm.testing.wait_for_lock()reports a lock wait of every request a slot runs, not only of operations: acommitthat waits for the lock of a deferred foreign key is reported.LockWait.requestis the waiting request;LockWait.operationisNonefor requests that are not anexecute.- A slot closed in the loop step in which its connection call ends delivers that call's outcome to the caller and stops serving. Before, the caller got
TypeError: invalid exception objectorSlot.close()and the event loop's shutdown never finished.
0.0.3 - 2026-11-17
- Deadlock detection checks each pool of the waiting tasks once per pass instead of once per waiting task: with many tasks waiting for a slot, waiting for and releasing a slot no longer costs time in proportion to the number of waiting tasks times the pool size.
0.0.2 - 2026-11-17
- PyPI project page: installation, an example and links to the documentation; documentation and changelog links and the author's e-mail in the package metadata.
0.0.1 - 2026-11-17
- Initial release.