2๐
โ
Im posting this as a future reference for myself and other who might have the same problem.
After searching for a bit I found out that django-tables2 was sending a single query for each row. The query was something like SELECT * FROM "table" LIMIT 1 OFFSET 1
with increasing offset.
I reduced the number of sql calls by calling query = list(query)
before i create the table and pass the query. By evaluating the query in the python view code the table now seems to work with the evaulated data instead and there is only one database call instead of hundreds.
๐คuser2602386
1๐
This was a bug and has been fixed in https://github.com/bradleyayers/django-tables2/issues/427
๐คInti
- [Django]-Login using django rest framework
- [Django]-How frequently should Python decorators be used?
- [Django]-Getting value of field of a reverse related model in django queryset
Source:stackexchange.com