You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Have you tested delete queries when using inner joins? For me it results in SQL commands that delete more than they should. Given the following models. As a note, I don't directly use this library.
When running the following delete command DataPoint.objects.filter(peripheral__controller=controller).delete() it results in the following SQL query:
DELETEFROM"iot_datapoint"WHERE"iot_datapoint"."time"IN
(SELECT U0."time"FROM"iot_datapoint" U0
INNER JOIN"iot_peripheral" U1 ON (U0."peripheral_id"= U1."id")
WHERE U1."controller_id"= 52dd4eea-e184-4f94-85de-bdd8490d5f9d)
When testing with two controllers that have independent peripherals and data points, all data points from both are deleted. The deletion works properly if controller.delete() is called. However, this approach does not work when having to manually deal with compressed data.
A work-around is to manually write the delete state. The following SQL delete command works:
DELETEFROM"iot_datapoint" B USING "iot_peripheral" C
WHEREB.peripheral_id=C.idANDC.controller_id='6dece05b007f41c7b16eada01ac382a0'::UUID;
The text was updated successfully, but these errors were encountered:
Have you tested delete queries when using inner joins? For me it results in SQL commands that delete more than they should. Given the following models. As a note, I don't directly use this library.
When running the following delete command
DataPoint.objects.filter(peripheral__controller=controller).delete()
it results in the following SQL query:When testing with two controllers that have independent peripherals and data points, all data points from both are deleted. The deletion works properly if
controller.delete()
is called. However, this approach does not work when having to manually deal with compressed data.A work-around is to manually write the delete state. The following SQL delete command works:
The text was updated successfully, but these errors were encountered: