1- django-spanner 
2- ============== 
1+ Cloud Spanner support for Django 
2+ ================================  
33
4- ORM plugin for using Cloud Spanner as a database for Django.
4+ ORM plugin for using Cloud Spanner as a `database backend 
5+ <https://docs.djangoproject.com/en/2.2/ref/databases/#using-a-3rd-party-database-backend> `__
6+ for Django.
57
6- 🚨THIS CODE IS STILL UNDER DEVELOPMENT🚨
7- ======================================== 
88
9- Table of contents
10- ----------------- 
11- 
12- -  `Installing it  <#installing-it >`__
13- -  `Using it  <#using-it >`__
14- 
15-    -  `Format  <#format >`__
16-    -  `Example  <#example >`__
9+ Installation
10+ ------------ 
1711
18- -  `Functional tests  <#functional-tests >`__
19- -  `Django integration tests  <#django-integration-tests >`__
12+ To use this library you'll need a Google Cloud Platform project with the Cloud
13+ Spanner API enabled. See the `Cloud Spanner Python client docs 
14+ <https://github.com/googleapis/python-spanner/#quick-start> `__ for details.
2015
21-    -  `django\_ test\_ suite.sh  <#django_test_suitesh >`__
16+ Use the version of ``python-spanner-django `` that corresponds to your version
17+ of Django.  For example, ``python-spanner-django `` 2.2.x works with Django
18+ 2.2.y. (This is the only supported version at this time.)
2219
23-       -  ` Environment variables  < #environment-variables >`__ 
24-       -  ` Example run  < #example-run >`__ 
20+ The minor release number of Django doesn't correspond to the minor release 
21+ number of `` python-spanner-django ``. Use the latest minor release of each. 
2522
26-    -  ` Parallelization script  < #parallelization-script >`__ 
23+ To install from PyPI: 
2724
28-       -  `Environment variables  <#environment-variables >`__
29-       -  `Example run  <#example-run >`__
25+ .. code :: shell 
3026
31- -  `Limitations  <#limitations >`__
32- -  `How it works  <#how-it-works >`__
27+     pip3 install django-google-spanner 
3328
34-    -  `Overall design  <#overall-design >`__
35-    -  `Internals  <#internals >`__
3629
37- Installing it
38- ------------- 
30+ 
3931
40- Use the version of django-spanner that corresponds to your version of
41- Django. For example, django-spanner 2.2.x works with Django 2.2.y. (This
42- is the only supported version at this time.)
32+ .. code :: shell 
4333
44- The minor release number of Django doesn't correspond to the minor
45- release number of django-spanner. Use the latest minor release of each.
34+     git clone [email protected] :googleapis/python-spanner-django.git 35+     cd  python-spanner-django 
36+     pip3 install -e .  
4637
47- .. code :: shell 
4838
49-     pip3 install --user .  
39+ 
40+ ------ 
5041
51- Using it 
52- -------- 
42+ After ` installattion  < #Installation >`__, you'll need to edit your Django 
43+ `` settings.py `` file: 
5344
54- After ` installing it  < #installing-it >`__, you'll need to edit your 
55- Django `` settings.py `` file: 
45+ -  Add `` django_spanner `` as the very first entry in the `` INSTALLED_APPS `` 
46+    setting 
5647
57- -  Add ``django_spanner `` as the very first entry in the
58-    ``INSTALLED_APPS `` setting
5948
6049   .. code :: python 
6150
@@ -107,18 +96,19 @@ Limitations
10796Transaction management isn't supported
10897~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
10998
110- django-spanner always works in Django's default transaction behavior,
111- ``autocommit `` mode. Transactions cannot be controlled manually with
112- calls like ``django.db.transaction.atomic() ``.
99+ ``python-spanner-django `` always works in ``autocommit `` mode, which is
100+ Django's default behavior even for backends that support manual transaction
101+ management. Transactions cannot be controlled manually with calls like
102+ ``django.db.transaction.atomic() ``.
113103
114104``AutoField `` generates random IDs
115105~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
116106
117107Spanner doesn't have support for auto-generating primary key values.
118- Therefore, django -spanner monkey-patches ``AutoField `` to generate a
119- random UUID4. It generates a default using ``Field ``'s ``default ``
120- option which  means ``AutoField ``\  s will have a value when a model
121- instance is created. For  example:
108+ Therefore, `` python -spanner-django ``  monkey-patches ``AutoField `` to generate a
109+ random UUID4. It generates a default using ``Field ``'s ``default `` option which 
110+ means ``AutoField ``\  s will have a value when a model instance is created. For 
111+ example:
122112
123113::
124114
@@ -136,16 +126,18 @@ were created.
136126~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
137127
138128Spanner doesn't support ``ON DELETE CASCADE `` when creating foreign-key
139- constraints so django-spanner `doesn't support foreign key 
140- constraints <https://github.com/googleapis/python-spanner-django/issues/313> `__.
129+ constraints so ``python-spanner-django `` `doesn't support foreign key 
130+ constraints 
131+ <https://github.com/googleapis/python-spanner-django/issues/313> `__.
141132
142133Check constraints aren't supported
143134~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
144135
145136Spanner doesn't support ``CHECK `` constraints so one isn't created for
146- ```PositiveIntegerField `` <https://docs.djangoproject.com/en/stable/ref/models/fields/#positiveintegerfield>`__
147- and
148- ```CheckConstraint `` <https://docs.djangoproject.com/en/stable/ref/models/constraints/#checkconstraint>`__
137+ `PositiveIntegerField 
138+ <https://docs.djangoproject.com/en/stable/ref/models/fields/#positiveintegerfield> `__
139+ and `CheckConstraint 
140+ <https://docs.djangoproject.com/en/stable/ref/models/constraints/#checkconstraint> `__
149141can't be used.
150142
151143``DecimalField `` isn't supported
@@ -185,7 +177,7 @@ Spanner has some limitations on schema changes which you must respect:
185177-  Renaming tables and columns isn't supported.
186178-  A column's type can't be changed.
187179-  A table's primary key can't be altered.
188- -  Migrations aren't atomic since django -spanner doesn't support
180+ -  Migrations aren't atomic since `` python -spanner-django ``  doesn't support
189181   transactions.
190182
191183``DurationField `` arithmetic doesn't work with ``DateField `` values (`#253  <https://github.com/googleapis/python-spanner-django/issues/253 >`__)
@@ -247,6 +239,3 @@ Internals
247239
248240.. figure :: ./assets/internals.png 
249241   :alt: 
250- 
251- 🚨🚨THIS CODE IS STILL UNDER DEVELOPMENT🚨🚨
252- ============================================ 
0 commit comments