encode / orm

An async ORM. 🗃
https://www.encode.io/orm
BSD 3-Clause "New" or "Revised" License
1.78k stars 98 forks source link

Create and friends ignore setting the PK #157

Open coderanger opened 2 years ago

coderanger commented 2 years ago

Creating a row with a manually-specified PK isn't super common but it does happen and should be supported one way or another.

AnirvanB commented 2 years ago

Upvoting.

nexy7574 commented 2 years ago

according to #143, this was intentional

roks0n commented 1 year ago

I agree, you can have a primary key index on a column that doesn't have AUTO_INCREMENT set. An ability to allow setting the value in such cases is mandatory, otherwise there's no way to create that entry via ORM.

Given this comment:

if you find maybe Django or SQLAlchemy have a different behaviour, we could change it.

I can confirm that Django's ORM allows settings a value for a primary_key column at creation time (I'm using that in one of my applications).