Skip to content

Commit 9e82fde

Browse files
committed
reorganize limitations in README
1 parent 05280ae commit 9e82fde

File tree

1 file changed

+28
-12
lines changed

1 file changed

+28
-12
lines changed

README.md

+28-12
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,35 @@ DATABASES = {
8282

8383
## Limitations
8484

85-
Limitation|Comment|Resolution
86-
---|---|---
87-
Lack of DEFAULT for columns|Cloud Spanner doesn't support using DEFAULT for columns thus the use of default values might have to enforced in your controller logic|
88-
Lack of FOREIGN KEY constraints|Cloud Spanner doesn't support foreign key constraints thus they have to be defined in code
89-
Lack of sequential and auto-assigned IDs|Cloud Spanner doesn't autogenerate IDs and this integration instead creates UUID4 to avoid [hotspotting](https://cloud.google.com/spanner/docs/schema-design#uuid_primary_key) so you SHOULD NOT rely on IDs being sorted|We generate UUID4s for each AutoField
90-
Numeric values are saved as FLOAT64|Cloud Spanner doesn't support the NUMERIC type thus we might have precision losses|Decimal and Numeric are translated to FLOAT64. If Cloud Spanner adds NUMERIC in the future, you might need to migrate your columns
91-
Optimistic transactions when running DDL and other statements|Cloud Spanner CANNOT run DDL (CREATE, DROP, ALTER) in a Transaction and CAN ONLY run them in the [DatabaseAdmin RPC]() so any mixes of DDL and other statements will make prior statements get run, DDL run, then following statements run separately|
92-
107 unexplored Django tests|We need to run every single test in the Django test suite for 100% certainty|Currently in progress to complete the [211 test cases](https://gist.github.com/odeke-em/d3476b6cb7c3485de6aa29956ed50a75#file-all_tests-txt)
93-
Table names CANNOT have spaces within them whether back-ticked or not|Cloud Spanner DOEST NOT support tables with spaces in them for example `Entity ID`|Ensure that your table names don't have spaces within them
94-
Table names CANNOT have punctuation marks and MUST contain valid UTF-8|Cloud Spanner DOEST NOT support punctuation marks e.g. periods ".", question marks "?" in table names|Ensure that your table names don't have punctuation marks
95-
Lack of stored procedures and triggers|Cloud Spanner DOES NOT support stored procedures nor triggers so if your code relies on them, you might need to move the logic into your application|Not supported
96-
Lack of VARIANCE, STDDEV database functions|Cloud Spanned doesn't yet implement these functions|
85+
### `AutoField` generates random IDs
9786

87+
Spanner doesn't have a way to auto-generate primary key values. Instead,
88+
django-spanner monkeypatches `AutoField` to generate a random UUID4. It
89+
generates a default using `Field`'s `default` option which means `AutoField`s
90+
will have a value when a model instance is created. For example:
91+
92+
```
93+
>>> ExampleModel()
94+
>>> ExampleModel.pk
95+
4229421414948291880
96+
```
97+
98+
To avoid [hotspotting](https://cloud.google.com/spanner/docs/schema-design#uuid_primary_key),
99+
these IDs are not monotonically increasing. This means that sorting models by
100+
id isn't guaranteed to return them in the order in which they were created.
101+
102+
### `ForeignKey` constraints aren't created
103+
104+
django-spanner [doesn't create foreign key constraints](https://github.com/googleapis/python-spanner-django/issues/313).
105+
106+
### `DecimalField` isn't supported
107+
108+
Spanner doesn't support a NUMERIC data type that allows storing high precision
109+
decimal values without the possibility of data loss.
110+
111+
### `Variance` and `StdDev` database functions aren't supported
112+
113+
Spanner doesn't have these functions.
98114

99115
## How it works
100116

0 commit comments

Comments
 (0)