зеркало из https://github.com/github/vitess-gh.git
a4c04f43e2
Signed-off-by: jawabuu <49921621+jawabuu@users.noreply.github.com> |
||
---|---|---|
.. | ||
custom_db_backends/vitess | ||
README.md |
README.md
Support for Django ORM
In order to use Vitess with Django ORM.
- You need to have mysqlclient installed.
pip install mysqlclient
- You need to override the defined backend
django.db.backends.mysql
to disable savepoints as they are not supported. - Foreign keys should also be disabled.
Since django allows us to use custom backends for database connections, the framework is more flexible than most for adapting to various types of databases.
Using Vitess with your django project.
- Copy the custom_db_backends directory to your django project.
- Edit your
settings.py
to have the following;
"ENGINE": custom_db_backends.vitess,
Notes
- This has been tested with python 3.7 and django 2.2.
- Schema modifications using django migration tool are not yet fully tested. However, any errors that arise can be fixed by overriding the file schema.py
- The django-vitess adapter could be maintained as a separate project within Vitess in future so users can run
pip install django-vitess
for their projects.