Repository navigation
🧬 Model inheritance: a relation you did not declare is refused, with the line to add
This release has two breaking changes. Both turn a failure you used to meet later, at first use or at connect(), into one you meet at install or import. The upgrade guide's After 0.29 section covers both.
Relations are not inherited
Veteran subclasses Player and does not declare team again:
class Player(Model):
id: int | None = Field(default=None, primary_key=True)
team_id: int = Field(foreign_key=Team)
team: Relation[Team] = Forward("team_id")
class Veteran(Player):
seasons: int = 0In 0.29 this class was defined, and veteran.team raised KeyError: 'team'. An inherited many-to-many wrote to the base's join table, and an inherited reverse relation listed the base's rows. Python now refuses the class when it defines it, and the message gives the line to add:
TypeError: Veteran.team: Player.team is not inherited, since a relation belongs to the class that declares it. Fix it by hand: (1) on Veteran, add `team: Relation[Team] = Forward("team_id")`
Add the line and the class loads, with the same columns, foreign keys and indexes as before. The same holds for a model built on a mixin that declares a relation. Columns are inherited as they always were (#1024).
Pydantic 2.12 and pydantic-settings 2.15 are required
Ferro declared pydantic>=2.0, but Field() already needed Pydantic 2.12, so an install on 2.11 went through and every model then failed to register. The floors are now declared, and a project pinned below either one gets a resolver error at install. Raise the pin to pydantic>=2.12 and pydantic-settings>=2.15. A project that runs 0.29 today has nothing to change. CI now runs the suite on exactly these floors (#1023).
Share columns with a mixin
The guide now teaches one way to give several models the same columns: a class that subclasses pydantic.BaseModel, listed before Model:
class Stamped(BaseModel):
created_at: datetime = Field(default_factory=lambda: datetime.now(UTC), index=True)
class Feedback(Stamped, Model):
id: int | None = Field(default=None, primary_key=True)
product_sku: str
body: strStamped gets no table. The feedback table holds created_at, with its index named idx_feedback_created_at. A Model base class still works, and adds a table of its own. Sharing columns between models shows both (#1029).
Also in this release
- The timestamps mixin stamps a partial save. The Timestamps how-to's
save()now addsupdated_attoonly=, sosave(only={"name"})writes the new time too. If you copied the earlier recipe, copy it again (#1022). - A new no-transaction step explains itself. The SQL file that
ferro migrate newscaffolds for a hand-written step lists each-- ferro:option with an example, says that a step outside a transaction re-runs from the top after a lock timeout, and links the docs pages for both (#1016). - Error messages no longer cite ADR or issue numbers. A message names the fix or a docs page you can open (#1013).
v0.30.0 (2026-12-01)
Bug Fixes
-
A subclass of a model with relations inherits only half of them (#924) (#1024,
1f3be6d) -
Error messages cite ADR and issue numbers a reader cannot follow (#989) (#1013,
a9c61f8) -
The timestamps how-to's mixin does not stamp updated_at on a partial save (#1019) (#1022,
7d7fef5)
Build System
Documentation
-
A no-transaction step says, where its author reads, that it re-runs from the top on a lock timeout (#616) (#1016,
6bab11a) -
Teach a mixin as the preferred way to share columns between models (#1028) (#1029,
ac7cf5a)
Detailed Changes: v0.29.0...v0.30.0