Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for json type (#714)
* performance files * test_benchmark * performance testing changes * changes in benchmark performance for prod * changes to number of runs * adding comments * linting changes * 3.2 changes * adding version change * lint changes and resmoving performance changes * version changes * chore: fix release build (#659) * chore: fix release build Fix release build by migrating to secret manager secrets and use templated kokoro configs for docs/ and release/ * fix: fix config names * chore: add populate secrets script * docs: fix license * chore: preserve original year * chore: revert years in manually committed files * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/master/packages/owl-bot/README.md * chore: update lockfile * chore: add .kokoro/docker directory Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> * feat: Added support for check constraint (#679) * feat: Added support for check constraint * fix: change decimal out of scale ProgramingError to ValueError * fix: skip check_constraints tests when running on emmulator * fix: remove check constraint for emulator * docs: update docs to show decimal field support and check constraints but no support for unsigned data type (#683) * test: Performance Testing (#675) * performance files * test_benchmark * performance testing changes * changes in benchmark performance for prod * changes to number of runs * adding comments * linting changes * changes for 3.2 * Revert "changes for 3.2" This reverts commit 488035c. * adding licence * chore: release 2.2.1b2 (#685) Release-As: 2.2.1b2 * chore: release 2.2.1b2 (#687) * chore: release 2.2.1b2 * Updated CHANGELOG.md Corrected the change log msg. Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Vikash Singh <3116482+vi3k6i5@users.noreply.github.com> * fix: Bump version number after 2.2.1b2 release (#688) * chor: Update repo to say beta release instead of alpha (#691) * fix: Bump version number after 2.2.1b2 release * Update setup.py Current release is beta so updating the same in setup.py * chore: release 2.2.1b3 (#693) Release-As: 2.2.1b3 * chore: release 2.2.1b3 (#694) * chore: release 2.2.1b3 * Updated CHANGELOG.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Vikash Singh <3116482+vi3k6i5@users.noreply.github.com> * fix: Bump version number after 2.2.1b3 release (#696) * chore: release 2.2.1b3 Release-As: 2.2.1b3 * fix: Bump version number after 2.2.1b3 release * fix: add test samples script and related kokoro files * fix: correct repo name from python-spanner to python-spanner-django * fix: correct license from Apache to BSD style * docs: lint fix for samples (#697) * Docs: fix changelog link and sample examples. (#700) * docs: update docs to show decimal field support and check constraints but no support for unsigned data type * docs: linked changelog correctly * docs: fix doc links for sample examples * fix: skip test cursor_executemany_with_empty_params_list as spanner support is not there * docs: update dbapi location in overview asset file (#702) * chore: migrate to main branch (#706) * chore: migrate to main branch * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * use latest post processor image * remove obsolete replacements in owlbot.py * update post processor image Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com> * fix: added fixes for latest feature changes in django 3.2 * fix: fixes for running tests for django3.2 * fix: change django repo path * test: test fixes for order by nulls first and last * docs: fix readme link target * test: set default auto field type in test settings * fix: update features to skip tests that are not support by spanner * fix: remove choices module from django3.2 as it has been removed from django 3.2 * feat: add json support * fix: correct JsonObject import path * fix: table_type is not supported in emulator * !fix: update dependency for json support * fix: views are not supported by spanner Co-authored-by: Astha Mohta <asthamohta@gmail.com> Co-authored-by: Astha Mohta <35952883+asthamohta@users.noreply.github.com> Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Dan Lee <71398022+dandhlee@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
- Loading branch information
1 parent
b163ed2
commit 1c1b601
Showing
9 changed files
with
113 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,7 @@ class Meta: | |
name="check_start_date", | ||
), | ||
] | ||
|
||
|
||
class Detail(models.Model): | ||
value = models.JSONField() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Copyright 2021 Google LLC | ||
# | ||
# Use of this source code is governed by a BSD-style | ||
# license that can be found in the LICENSE file or at | ||
# https://developers.google.com/open-source/licenses/bsd | ||
|
||
from .models import Detail | ||
import unittest | ||
from django.test import TransactionTestCase | ||
from django.db import connection | ||
from django_spanner import USE_EMULATOR | ||
from tests.system.django_spanner.utils import ( | ||
setup_instance, | ||
teardown_instance, | ||
setup_database, | ||
teardown_database, | ||
) | ||
|
||
|
||
@unittest.skipIf(USE_EMULATOR, "Jsonfield is not implemented in emulator.") | ||
class TestJsonField(TransactionTestCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
setup_instance() | ||
setup_database() | ||
with connection.schema_editor() as editor: | ||
# Create the tables | ||
editor.create_model(Detail) | ||
|
||
@classmethod | ||
def tearDownClass(cls): | ||
with connection.schema_editor() as editor: | ||
# delete the table | ||
editor.delete_model(Detail) | ||
teardown_database() | ||
teardown_instance() | ||
|
||
def test_insert_and_fetch_value(self): | ||
""" | ||
Tests model object creation with Detail model. | ||
Inserting json data into the model and retrieving it. | ||
""" | ||
json_data = Detail(value={"name": "Jakob", "age": "26"}) | ||
json_data.save() | ||
qs1 = Detail.objects.all() | ||
self.assertEqual(qs1[0].value, {"name": "Jakob", "age": "26"}) | ||
# Delete data from Detail table. | ||
Detail.objects.all().delete() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters