This repository was archived by the owner on Mar 20, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -150,6 +150,22 @@ Spanner has some limitations on schema changes which you must respect:
150150* A table's primary key can't be altered.
151151* Migrations aren't atomic since django-spanner doesn't support transactions.
152152
153+ ### ` DurationField ` arithmetic doesn't work with ` DateField ` values ([ #253 ] ( https://github.com/googleapis/python-spanner-django/issues/253 ) )
154+
155+ Spanner requires using different functions for arithmetic depending on the
156+ column type:
157+
158+ * ` TIMESTAMP ` columns (` DateTimeField ` ) require ` TIMESTAMP_ADD ` or
159+ ` TIMESTAMP_SUB `
160+ * ` DATE ` columns (` DateField ` ) require ` DATE_ADD ` or ` DATE_SUB `
161+
162+ Django doesn't provide a way to determine which database function to use.
163+ ` DatabaseOperations.combine_duration_expression() ` arbitrary uses
164+ ` TIMESTAMP_ADD ` and ` TIMESTAMP_SUB ` . Therefore, if you use a ` DateField ` in a
165+ ` DurationField ` expression, you'll see an error like: "No matching signature
166+ for function TIMESTAMP_ADD for argument types: DATE, INTERVAL INT64
167+ DATE_TIME_PART."
168+
153169### Computations that yield FLOAT64 values can't be assigned to INT64 columns
154170
155171Spanner [ doesn't support this] ( https://github.com/googleapis/python-spanner-django/issues/331 ) .
You can’t perform that action at this time.
0 commit comments