Blogs / Why One Table Needs Several Models, and the Idea PEP 827 Offers

Why One Table Needs Several Models, and the Idea PEP 827 Offers

What the Language Summit write-up says each CRUD operation needs from a model, and the idea PEP 827 offers for keeping them in step.

  • Learning
  • 1 min read

For: Learners new to web backends.

Several models for one table

Another use-case PEP 827 serves is generating new types programmatically, such as for CRUD (Create, Read, Update, Delete) web applications, where a single database table typically has a separate ORM model definition for each CRUD operation.[1]

Keeping all of these models and parameters up-to-date with the database model requires lots of diligence and can’t usually be done programmatically.[1]

What each operation needs

Create would require all properties without defaults, Read would include all the public properties of a model, and Update would make all properties optional (supporting the PATCH HTTP method).[1]

Delete doesn’t typically need a model, as only the primary key is needed to delete a record.[1]

Createall properties withoutdefaultsUpdateall properties optionalDeleteonly the primary key
What does each operation need, according to the write-up?

The idea PEP 827 offers

So what if there was a way to instead contain the complexity within a type that transforms the overall model type for each of the CRUD operations?[1]

The PEP was also designed so that no new keywords would be required to adopt it.[1]

Sources

  1. PEP 827: Type Manipulation (Python Language Summit 2026) (blog.python.org · checked )

More articles