-
Notifications
You must be signed in to change notification settings - Fork 292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SpannerTemplate#update ambiguously requires primary keys in includeProperties #1987
Comments
Hi @austinmilt, thanks for bringing this up. Do you have a code sample that I can try to replicate this issue with? I want to confirm that including the primary key is required or if there is something that might be requiring the primary key to be included. |
Sure! See if this works for you: https://github.com/austinmilt/gcp-spanner-issue-1987 Here's my stdout:
|
Is this happening with the real Spanner instance as well, or just the emulator? |
I havent spun up a real spanner instance yet. I'm trying to do most of my development locally before adding that expense. |
@olavloite : Do you know if this is/was a known Spanner emulator issue? |
Is your feature request related to a problem? Please describe.
I was getting a
NOT_FOUND
error from the spanner emulator because I was not including the primary keys of my POJO inincludeProperties
inSpannerTemplate#update(Object object, Set<String> includeProperties)
. Documentation (primarily this) does not say this is necessary. Since primary keys are immutable, it implies that primary keys should not be inincludeProperties
.Setup
Spring Cloud Spanner
com.google.cloud:spring-cloud-gcp-dependencies:4.5.0
com.google.cloud:spring-cloud-gcp-starter-data-spanner
(inherited version)Cloud Spanner Emulator
gcr.io/cloud-spanner-emulator/emulator:latest
Describe the solution you'd like
Require that primary keys be defined - not null - on the update POJO but not in
includeProperties
. I think the easiest way to accomplish this is to add the primary keys toincludeProperties
withinSpannerTemplate#update
orSpannerMutationFactoryImpl#update
Describe alternatives you've considered
Clearly document in Spring Cloud GCP that primary keys must be in
includeProperties
, ideally in both the inline docs and API docs.Additional context
The specific error is
io.grpc.StatusRuntimeException: NOT_FOUND: Table users: Row {String(NULL)} not found.
Example of
Mutation#toString
created by Spring Cloud Spanner with and without putting the primary keys inincludeProperties
:[update(users{user_id=61c71f46-a11f-4340-914d-23b54a02ccb3,credits=243498372})]
[update(users{credits=206320900})]
The text was updated successfully, but these errors were encountered: