Missing ids in query that bulk_create produces.
See original GitHub issueDescribe the bug
Hi! Model.bulk_create
excludes object ids from query that it produces. This leads the ids to an ascending order, even if otherwise specified.
To Reproduce
# models.py
class SomeModel(models.Model):
id = fields.IntField(pk=True)
field = fields.IntField()
# test_bulk_create.py
import models
async def test_bulk_create_ids():
await models.SomeModel.bulk_create(
[
models.SomeModel(id=100, field=1),
models.SomeModel(id=200, field=1)
]
)
objs = await models.SomeModel.all()
assert objs[0].id == 1
assert objs[1].id == 2
Expected behavior The bulk_create creates the ids according to objects that it gets.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
SQL: find missing IDs in a table - Stack Overflow
Easiest solution for me: Create a select that gives all ids up to max sequence value (ex:1000000) ...
Read more >mysql - How to get missing values in row order?
In MySQL you can use LIMIT (after ORDER BY ) instead of TOP . If the missing id values are in the beginning...
Read more >SQL SERVER - Discussion - Effect of Missing Identity on System
So, the question is this: “Do you know a real-world scenario where a Missing Identity value in any table can create problems?“ I...
Read more >Debugging missing data in SQL query results - Metabase
What to do when your query returns data that's missing rows or columns. ... SELECT * FROM orders o JOIN products p ON...
Read more >SQL Scripts: How To Find Missing Indexes
The below query will show missing index suggestions for the specified ... This script also generates a CREATE INDEX script for each record, ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Oh, hold on. I missed the issue here. Blame lack of sleep. Apologies.
This should be fixed in the next release. You can test by doing a