GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: if JsonObject serialized to None then return `null_value` instead of `string_value` by o-aleks · Pull Request #771 · googleapis/python-spanner

This repository was archived by the owner on Jun 8, 2026. It is now read-only.

Conversation

@o-aleks

@o-aleks o-aleks commented Jul 15, 2022

Copy link
Copy Markdown
Contributor

No description provided.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@o-aleks
fix: if JsonObject serialized to None then return null_value instea…
250b23c
…d of `string_value`
@o-aleks
o-aleks requested review from a team July 15, 2022 14:58
@google-cla

google-cla Bot commented Jul 15, 2022

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@product-auto-label product-auto-label Bot added size: xs Pull request size is extra small. api: spanner Issues related to the googleapis/python-spanner API. labels Jul 15, 2022
@asthamohta
Merge branch 'main' into serialize_none_json
5257755
@asthamohta asthamohta added the kokoro:run Add this label to force Kokoro to re-run the tests. label Jul 19, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Jul 19, 2022
o-aleks and others added 2 commits July 21, 2022 17:21
@o-aleks
Merge branch 'main' into serialize_none_json
dc3cf1c
@parthea
Merge branch 'main' into serialize_none_json
bd6a5cf
@parthea parthea added kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. owlbot:run Add this label to trigger the Owlbot post processor. labels Aug 12, 2022
@gcf-owl-bot gcf-owl-bot Bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Aug 12, 2022
@yoshi-kokoro yoshi-kokoro removed kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Aug 12, 2022
@parthea
Merge branch 'main' into serialize_none_json
9e67ccd
@asthamohta

asthamohta commented Aug 22, 2022

Copy link
Copy Markdown
Contributor

hi @o-aleks, what is this PR for?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@o-aleks

o-aleks commented Aug 22, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Hi @asthamohta,

There is a bug in _make_value_pb function.
If the value is an instance of JsonObject and it is None after serializing, then it should be translated to NULL_VALUE, but in the original code, it is a string.

My fix is:

def _make_value_pb(value):
    ...
    if isinstance(value, JsonObject):
        value = value.serialize()
        if value is None:
            return Value(null_value="NULL_VALUE")
        else:
            return Value(string_value=value)

Could you please check it and approve the PR?
Thank you.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@asthamohta
Merge branch 'main' into serialize_none_json
41c0ca6
@asthamohta asthamohta added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 24, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 24, 2022
@IlyaFaer

IlyaFaer commented Aug 24, 2022

Copy link
Copy Markdown

Should be okay. There is an if statement upper in the method, which does the same for all the data types, but JsonObject is more complicated than other types, so it passes the condition (and we can't change this behavior for the class, because there is no magic method for is None statements).

A test should be added though. @o-aleks, will you find time to add a test? Or I can do it in a separate issue.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@o-aleks

o-aleks commented Aug 24, 2022

Copy link
Copy Markdown
Contributor Author

A test should be added though. @o-aleks, will you find time to add a test? Or I can do it in a separate issue.
Oh, yes, of course, I'll add the test.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@o-aleks
test: covered the case by test
fb7c917
@product-auto-label product-auto-label Bot added size: s Pull request size is small. and removed size: xs Pull request size is extra small. labels Aug 24, 2022
Ilya Gurov
Merge branch 'main' into serialize_none_json
03bc609
@asthamohta asthamohta added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 25, 2022
IlyaFaer
IlyaFaer approved these changes Aug 25, 2022
View reviewed changes
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 25, 2022
@IlyaFaer
IlyaFaer merged commit 82170b5 into googleapis:main Aug 25, 2022
@release-please release-please Bot mentioned this pull request Aug 25, 2022
chore(main): release 3.20.0 #790
Merged
@IlyaFaer

IlyaFaer commented Aug 25, 2022

Copy link
Copy Markdown

Thanks, @o-aleks, looks good, and tests are passing fine. I'm merging it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gcf-merge-on-green Bot pushed a commit that referenced this pull request Aug 30, 2022
@release-please
chore(main): release 3.20.0 (#790)
6a941ef
🤖 I have created a release *beep* *boop*
---


## [3.20.0](v3.19.0...v3.20.0) (2022-08-30)


### Features

* Adds TypeAnnotationCode PG_JSONB ([#792](#792)) ([6a661d4](6a661d4))


### Bug Fixes

* if JsonObject serialized to None then return `null_value` instead of `string_value` ([#771](#771)) ([82170b5](82170b5))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
parthea pushed a commit to googleapis/google-cloud-python that referenced this pull request Mar 9, 2026
@release-please
chore(main): release 3.20.0 (#790)
51bf1d1
🤖 I have created a release *beep* *boop*
---


## [3.20.0](googleapis/python-spanner@v3.19.0...v3.20.0) (2022-08-30)


### Features

* Adds TypeAnnotationCode PG_JSONB ([#792](googleapis/python-spanner#792)) ([6a661d4](googleapis/python-spanner@6a661d4))


### Bug Fixes

* if JsonObject serialized to None then return `null_value` instead of `string_value` ([#771](googleapis/python-spanner#771)) ([82170b5](googleapis/python-spanner@82170b5))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

1 more reviewer
@IlyaFaer IlyaFaer IlyaFaer approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

api: spanner Issues related to the googleapis/python-spanner API. size: s Pull request size is small.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@o-aleks @asthamohta @IlyaFaer @parthea @yoshi-kokoro
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.