-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
api: spannerIssues related to the Spanner API.Issues related to the Spanner API.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.
Description
Hi,
I have a use case that requires to update just one column of a table. To do that, i tried to use insert_or_update as documentation says it will update some columns and preserve others' values. But i get an error below, says i am trying to insert new row without not null columns? Why does not it checks row already exist ?
What am i missing here ? Here is my mutation build code too. I get primary keys and map them to mutation as is. First 4 fields are all part of primary key.
Mutation.newInsertOrUpdateBuilder("orders")
.set("appkey").to(result.getString("appkey"))
.set("GlobalId").to(result.getString("globalid"))
.set("Id").to(result.getLong("id"))
.set("TicketId").to(result.getLong("TicketId"))
.set("finalprice").to(result.getDouble("price"))
.build();
public static final Mutation.Op INSERT_OR_UPDATE
Like INSERT, except that if the row already exists, then its column values are overwritten with the ones provided. Any column values not explicitly written are preserved.
io.grpc.StatusRuntimeException: FAILED_PRECONDITION: A potentially-new row in table Orders does not specify a non-null value for these NOT NULL columns: AccountTransactionTypeId, CalculatePrice, CreatedDateTime, DecreaseInventory, DepartmentId, etc..
at io.grpc.Status.asRuntimeException(Status.java:543) ~[grpc-core-1.4.0.jar:1.4.0]
at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:442) ~[grpc-stub-1.4.0.jar:1.4.0]
at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:56) ~[grpc-core-1.4.0.jar:1.4.0]
at com.google.cloud.spanner.spi.v1.SpannerErrorInterceptor$1$1.onClose(SpannerErrorInterceptor.java:100) ~[google-cloud-spanner-0.22.0-beta.jar:0.22.0-beta]
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api: spannerIssues related to the Spanner API.Issues related to the Spanner API.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.