We can get any django query by putting .query
in the end, like this:
print(MyModel.objects.all().query)
It print the resulting query, without querying the database.
Is there a way to get the query for bulk_create
or bulk_update
, without actually querying the database?
Additional question:
Is it possible to guess, if a bulk query may throw the below error or not (by comparing the bulk query size with max allowed query packet size)?
(1153, "Got a packet bigger than 'max_allowed_packet' bytes")