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
This commit is contained in:
mountford 2017-02-06 09:31:32 -08:00 committed by Ben McIlwain
parent 6f00059a80
commit 6fd3592a54

View file

@ -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()