Skip to content

Bugfixes and table sql comment

Latest

Choose a tag to compare

@collerek collerek released this 08 Jun 16:37
· 7 commits to master since this release
a7e7fde

0.26.0

✨ Features

  • Add OrmarConfig(comment=...) to attach a SQL COMMENT ON TABLE value to a model — forwarded to the underlying SQLAlchemy Table and emitted by metadata.create_all() on dialects that support table comments (PostgreSQL, MySQL; SQLite ignores it). #1240

🐛 Fixes

  • Fix an unexpected cartesian product (cross join) when filtering on two foreign keys that reach the same target table through the same relation (e.g. a_port__switch__name and z_port__switch__name). The filter now resolves complex join aliases in the same depth-first order as the join builder, and ignores complex aliases left in the globally shared alias manager by earlier queries, so a repeated query is no longer corrupted. #1706
  • Require ormar-utils >=0.2.0, which ships CPython stable-ABI (abi3) wheels. A single wheel now works on Python 3.10+ — including 3.14 and future releases — so installing ormar no longer fails for lack of a matching ormar-utils wheel on a new Python. #1702
  • Fix race in get_or_create (and the m2m / reverse-fk variant) where concurrent callers leaked IntegrityError. #1016
  • Fix update_or_create raising NoMatch instead of creating when called with a pk that doesn't exist in the database.
  • Fix values() / values_list() leaking columns of related models that were pulled in by a filter (e.g. filter(project__id=...)) or by a bare select_related() but never named in fields(). Such relations - and their through models for m2m - are now excluded from the projected result, matching the columns the caller actually requested. #800
  • Fix values() / values_list() leaking main-model columns when fields() named only nested fields (e.g. values_list("garage__owner", flatten=True)). The flat projection now drops every column from any model the caller never named - including the parent FK column and any in-between models the path passes through - so flatten=True returns the requested nested value instead of the first leaked main-model column. #1060