Reputation: 1121
To perform upsert operations in Tortoise, we can use the bulk_create
method. For this we should provide both update_fields
and on_conflict
params. Like this:
await Users.bulk_create(users_list, on_conflict=fields_list, update_fields=fields_list)
The official documentation lacks examples or in-depth explanations of what the difference is between these two parameters. But it forces me to set them both. Why?
Upvotes: 1
Views: 274