From 9b124b4e15dfa6efaff8975bf4a258b4b43b3c99 Mon Sep 17 00:00:00 2001 From: Vikash Singh <3116482+vi3k6i5@users.noreply.github.com> Date: Mon, 26 Jul 2021 12:39:33 +0530 Subject: [PATCH 1/4] docs: update docs to show decimal field support and check constraints but no support for unsigned data type --- README.rst | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/README.rst b/README.rst index e79e23cd91..637ffe6c7e 100644 --- a/README.rst +++ b/README.rst @@ -283,23 +283,16 @@ were created. Spanner does not support ``ON DELETE CASCADE`` when creating foreign-key constraints, so this is not supported in ``django-google-spanner``. -Check constraints aren't supported -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +``Unsigned`` datatypes are not supported +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Spanner does not support ``CHECK`` constraints so one isn't created for -`PositiveIntegerField +Spanner does not support ``Unsigned`` datatypes so `PositiveIntegerField `__ -and `CheckConstraint -`__ -can't be used. - -No native support for ``DecimalField`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Spanner's support for `Decimal `__ -types is limited to -`NUMERIC `__ -precision. Higher-precision values can be stored as strings instead. +and `PositiveSmallIntegerField +`__ +are both stored as `Integer type +`__ +. ``Meta.order_with_respect_to`` model option isn't supported ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From 8f077cc6bbc35db37eb82dcda5215dd16ed0d35c Mon Sep 17 00:00:00 2001 From: Vikash Singh <3116482+vi3k6i5@users.noreply.github.com> Date: Wed, 18 Aug 2021 20:23:38 +0530 Subject: [PATCH 2/4] docs: linked changelog correctly --- docs/changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 120000 docs/changelog.md diff --git a/docs/changelog.md b/docs/changelog.md deleted file mode 100644 index 825c32f0d0..0000000000 --- a/docs/changelog.md +++ /dev/null @@ -1 +0,0 @@ -# Changelog diff --git a/docs/changelog.md b/docs/changelog.md new file mode 120000 index 0000000000..04c99a55ca --- /dev/null +++ b/docs/changelog.md @@ -0,0 +1 @@ +../CHANGELOG.md \ No newline at end of file From 935514bdeff553ee65c9fb8df510a4a3c1fb20f5 Mon Sep 17 00:00:00 2001 From: Vikash Singh <3116482+vi3k6i5@users.noreply.github.com> Date: Wed, 18 Aug 2021 20:57:51 +0530 Subject: [PATCH 3/4] docs: fix doc links for sample examples --- docs/example_from_scratch.md | 1 + docs/example_healthchecks.md | 1 + docs/samples.rst | 30 +++++++++--------------------- 3 files changed, 11 insertions(+), 21 deletions(-) create mode 120000 docs/example_from_scratch.md create mode 120000 docs/example_healthchecks.md diff --git a/docs/example_from_scratch.md b/docs/example_from_scratch.md new file mode 120000 index 0000000000..1e40292b5e --- /dev/null +++ b/docs/example_from_scratch.md @@ -0,0 +1 @@ +../examples/from-scratch/README.md \ No newline at end of file diff --git a/docs/example_healthchecks.md b/docs/example_healthchecks.md new file mode 120000 index 0000000000..08983d890b --- /dev/null +++ b/docs/example_healthchecks.md @@ -0,0 +1 @@ +../examples/healthchecks/README.md \ No newline at end of file diff --git a/docs/samples.rst b/docs/samples.rst index 3e20575e24..09d8c37590 100644 --- a/docs/samples.rst +++ b/docs/samples.rst @@ -1,24 +1,12 @@ -Sample Code -#################################### +Sample Examples +############### -Create and register your first model -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -To define your database layout create a models file in your app folder and add the relevant -classes to it. Spanner works exactly like any other database you may have used with Django. -Here is a simple example you can run with Spanner. In our poll application below we create -the following two models: +django-spanner for Django tutorial +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. code:: python +This `Example `_ shows how to use django-spanner for Cloud Spanner as a backend database for `healthchecks.io `_ - from django.db import models - - class Question(models.Model): - question_text = models.CharField(max_length=200) - pub_date = models.DateTimeField('date published') - def __str__(self): - return str(self.rating) - - class Choice(models.Model): - question = models.ForeignKey(Question, on_delete=models.CASCADE) - choice_text = models.CharField(max_length=200) - votes = models.IntegerField(default=0) +django-spanner on healthchecks.io +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This `Example `_ shows how to use django-spanner for Cloud Spanner as a backend database for `Django's tutorials `_ From 88480a04b168fdf84397fb58c8aa31fb0a8c5b66 Mon Sep 17 00:00:00 2001 From: Vikash Singh <3116482+vi3k6i5@users.noreply.github.com> Date: Thu, 19 Aug 2021 13:22:21 +0530 Subject: [PATCH 4/4] fix: skip test cursor_executemany_with_empty_params_list as spanner support is not there --- django_spanner/features.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/django_spanner/features.py b/django_spanner/features.py index 050ba9c7b9..a0ae6299c3 100644 --- a/django_spanner/features.py +++ b/django_spanner/features.py @@ -38,6 +38,8 @@ class DatabaseFeatures(BaseDatabaseFeatures): skip_tests = ( # No foreign key constraints in Spanner. "backends.tests.FkConstraintsTests.test_check_constraints", + # Spanner does not support empty list of DML statement. + "backends.tests.BackendTestCase.test_cursor_executemany_with_empty_params_list", "fixtures_regress.tests.TestFixtures.test_loaddata_raises_error_when_fixture_has_invalid_foreign_key", # No Django transaction management in Spanner. "basic.tests.SelectOnSaveTests.test_select_on_save_lying_update",