Changes between Version 21 and Version 22 of NoSqlSupport
- Timestamp:
- Dec 3, 2013, 5:45:41 PM (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
NoSqlSupport
v21 v22 8 8 }}} 9 9 10 The [http:// www.allbuttonspressed.com/projects/django-nonrelDjango-nonrel] branch of Django already provides support for NoSQL and it requires only minimal changes to Django's ORM. However, for the more interesting features like `select_related()` Django's ORM needs to be refactored and simplified in several areas. Many of the sections in this page are described from the point of view of Django-nonrel since a lot of experience required for official NoSQL support has been integrated in the Django-nonrel project.10 The [http://django-nonrel.org/ Django-nonrel] branch of Django already provides support for NoSQL and it requires only minimal changes to Django's ORM. However, for the more interesting features like `select_related()` Django's ORM needs to be refactored and simplified in several areas. Many of the sections in this page are described from the point of view of Django-nonrel since a lot of experience required for official NoSQL support has been integrated in the Django-nonrel project. 11 11 12 12 For the record, Django-nonrel has quite a few backends, already: 13 13 14 * App Engine: [http ://www.allbuttonspressed.com/projects/djangoappengine djangoappengine]15 * MongoDB: [https://github.com/django- mongodb-engine/mongodb-engine django-mongodb-engine]14 * App Engine: [https://github.com/django-nonrel/djangoappengine djangoappengine] 15 * MongoDB: [https://github.com/django-nonrel/mongodb-engine django-mongodb-engine] 16 16 * !ElasticSearch: [https://github.com/aparo/django-elasticsearch django-elasticsearch] 17 17 * Cassandra: [https://github.com/vaterlaus/django_cassandra_backend django_cassandra_backend] … … 45 45 = select_related() = 46 46 47 [https://code.djangoproject.com/attachment/ticket/16385/0ad3af376503d32dab0adb8c9aaa57bd389ea0b2.diff Patch] 47 Tickets: #17335 48 48 49 49 Problem:: Django's internal representation of `select_related()` depends on JOINs, which aren't supported on NoSQL DBs. … … 51 51 Solution:: Django needs to provide a simpler internal representation of `select_related()` which allows the backend to easily retrieve the related models and their selected fields (so deferred fields aren't loaded unnecessarily). 52 52 53 Implementation status:: Django-nonrel merelyprovides a `connection.feature.supports_select_related` flag which tells `QuerySet` that the backend won't return additional data for the related data in the result rows (otherwise `select_related()` causes bad results full of `None` values). All NoSQL backends set this flag to `False`.53 Implementation status:: This has been merged. Django now provides a `connection.feature.supports_select_related` flag which tells `QuerySet` that the backend won't return additional data for the related data in the result rows (otherwise `select_related()` causes bad results full of `None` values). All NoSQL backends set this flag to `False`. 54 54 55 55 = !AutoField = 56 56 57 [https://code.djangoproject.com/attachment/ticket/16385/043f2c08b87dda585d40a1ab225106543909f4a6.diff Patch] 57 Tickets: #17337 58 58 59 59 Problem:: Currently, `AutoField` assumes that it's always an integer. However, in several NoSQL DBs (MongoDB, SimpleDB, etc.) the primary key is a string. … … 69 69 = INSERT vs UPDATE = 70 70 71 [https://code.djangoproject.com/attachment/ticket/16385/2885579c6f8a2f41422788b0abdee3da816144f8.diff Patch] 71 Tickets: #17340 72 72 73 73 Problem:: Currently, `Model.save_base()` runs a check whether the pk already exists in the database. This check is necessary for SQL, but it's unnecessary and inefficient on many NoSQL DBs which have an "upsert" operation that inserts or overwrites the entry in the DB. App Engine also doesn't allow to run queries within (optimistic) transactions, so the current `save()` method doesn't work on App Engine. … … 119 119 This is already implemented in Django-nonrel. 120 120 121 == !ImageField ==122 123 Currently, !ImageField depends on PIL. It might be necessary to provide a backend API for sandboxed platforms (like App Engine) that don't provide PIL support.124 125 This is not implemented in Django-nonrel.126 127 121 = Serializers = 128 122 … … 135 129 For optimization purposes it's very important to allow batch-saving and batch-deleting a list of model instances (which, in the case of batch-deletion, is not exactly the same as `QuerySet.delete()` which first has to fetch the entities from the DB in order to delete them). 136 130 137 This is not implemented in Django-nonrel, but Vladimir Mihailencohas implemented a patch which could be integrated.131 This is not implemented in Django-nonrel, but [http://vladimir-mihailenco.appspot.com/articles/1001/batch-operations-support-for-django-nonrel/ Vladimir Mihailenco] has implemented a patch which could be integrated. 138 132 139 133 = Transactions = … … 158 152 = Auth password reset URLs = 159 153 160 #14881, [https://code.djangoproject.com/attachment/ticket/16385/c9f97bd7397a39ebcb9f8831b28d5ab3b4e57038.diff Patch] 154 Tickets: #14881 161 155 162 156 Problem:: `django.contrib.auth`'s password reset URLs contain a base36-encoded user ID (`/reset/<user-id>/<token>/`). Several NoSQL backends (MongoDB, SimpleDB, etc.) use string-based primary keys. The password reset feature breaks if the user ID (the primary key) is not an integer (because base36 can only express integers). … … 164 158 Solution:: Encode the user ID in a URL-safe variant of base64. This is a backwards-incompatible change that breaks "old-style" password reset URLs, but backwards compatibility should be very easy to implement if required. 165 159 166 Implementation status:: This is already implemented in Django-nonrel, but it's not yet backwards-compatible.160 Implementation status:: This has been merged. 167 161 168 162 = Minor issues =