From 6fd3592a547ab8af87bda6237e3caa848886ebba Mon Sep 17 00:00:00 2001 From: mountford Date: Mon, 6 Feb 2017 09:31:32 -0800 Subject: [PATCH] Change BigQuery call from update to patch For invoicing, we have been using the BigQuery update() call, but it turns out that that's not what we want to do. That replaces all values, clearing out any that you don't specify. What we want is patch(), which updates only the values you specify. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=146673068 --- java/google/registry/bigquery/BigqueryConnection.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/java/google/registry/bigquery/BigqueryConnection.java b/java/google/registry/bigquery/BigqueryConnection.java index 0cda6dbf7..e19b1829d 100644 --- a/java/google/registry/bigquery/BigqueryConnection.java +++ b/java/google/registry/bigquery/BigqueryConnection.java @@ -376,8 +376,11 @@ public class BigqueryConnection implements AutoCloseable { TableReference ref = table.getTableReference(); try { if (checkTableExists(ref.getDatasetId(), ref.getTableId())) { + // Make sure to use patch() rather than update(). The former changes only those properties + // which are specified, while the latter would change everything, blanking out unspecified + // properties. bigquery.tables() - .update(ref.getProjectId(), ref.getDatasetId(), ref.getTableId(), table) + .patch(ref.getProjectId(), ref.getDatasetId(), ref.getTableId(), table) .execute(); } else { bigquery.tables()