Monday, September 28, 2020

Re: Django Mysql Bulk_Create Ids

Unfortunately MySQL doesn't support an equivalent of the RETURNING clause on PostgreSQL/Oracle.

In other words MySQL only allows to retrieve an inserted row auto id one at a time through its non-standard LAST_INSERT_ID function.

That prevents any attempts at inserting multiple rows and retrieving their corresponding primary key.

Cheers,
Simon

Le dimanche 27 septembre 2020 à 19:15:11 UTC-4, rohan...@gmail.com a écrit :
How can we make this happen? 
What steps would be needed so that bulk_create ends up returning the ids of the items that just got created? I don't want to be machine gunning my db with save statements to retrieve ids. 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f9cddbc9-85f7-487e-8d12-7a6445e4e870n%40googlegroups.com.

No comments:

Post a Comment