enhancements in django.db.models to get info about additional tables
|Reported by:||fetzig||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.2|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
would like to see this patch in django. why? i'm trying to explain...without being to verbose...
i'm using django-johnny-cache (automatically caches results of querysets).
the concept is pretty simple (still more simplified):
- create cache key: table name + md5 hash of the db query (and its params).
- get/set cache works without any additional configuration in the code.
- update/insert/delete: invalidate all keys relating to this table (problem is: there is more than one table...)
when creating select statements which aggregate data of multiple tables the cache is not working correctly. => it doesn't invalidate all invalid cache keys. => you get old data :(
there is a fix for that, but it includes patching django
please have a look at this patch (attached). its totally backward compatible. just adds a table variable/property on some places. it looks ok for me...
link to johnny-cache issue http://bitbucket.org/jmoiron/johnny-cache/issue/7/use-subselect-tables-in-query-cache-key
thanks for feedback.
feel free to ask for more info.