Facing OperationalError while bulk updating the product model with the below data. Here I have set basemodel_ptr_id as the primary key in the database and I have assinged basemodel_ptr_id to id in the product model.
Product Model
class ProductModel(Model):
basemodel_ptr: ForeignKeyFieldInstance[BaseModel] = fields.OneToOneField('models.BaseModel')
id = fields.IntField(unique=True, pk=True, source_field="basemodel_ptr_id")
name = fields.CharField(max_length=200)
no_of_items = fields.DecimalField(max_digits=20, decimal_places=2)
Error
tortoise.exceptions.OperationalError: column "id" does not exist
To Reproduce
This below line of code will replicate the issue with the above product model.
Facing OperationalError while bulk updating the product model with the below data. Here I have set basemodel_ptr_id as the primary key in the database and I have assinged basemodel_ptr_id to id in the product model.
Product Model
Error
To Reproduce
This below line of code will replicate the issue with the above product model.
Expected behavior
Latest model should be updated without any error and it should identify the primary key based on the source field defined for the model in the id.