Skip to content

Commit 0b7d911

Browse files
authored
docs: rename alter materialized view to update (#1754)
Alter implies a DDL sql ALTER MATERIALIZED VIEW statement, the code sample is purely an API update example.
1 parent a62a9f4 commit 0b7d911

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ Samples are in the [`samples/`](https://github.com/googleapis/java-bigquery/tree
113113
| --------------------------- | --------------------------------- | ------ |
114114
| Add Column Load Append | [source code](https://github.com/googleapis/java-bigquery/blob/main/samples/snippets/src/main/java/com/example/bigquery/AddColumnLoadAppend.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/AddColumnLoadAppend.java) |
115115
| Add Empty Column | [source code](https://github.com/googleapis/java-bigquery/blob/main/samples/snippets/src/main/java/com/example/bigquery/AddEmptyColumn.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/AddEmptyColumn.java) |
116-
| Alter Materialized View | [source code](https://github.com/googleapis/java-bigquery/blob/main/samples/snippets/src/main/java/com/example/bigquery/AlterMaterializedView.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/AlterMaterializedView.java) |
117116
| Auth Drive Scope | [source code](https://github.com/googleapis/java-bigquery/blob/main/samples/snippets/src/main/java/com/example/bigquery/AuthDriveScope.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/AuthDriveScope.java) |
118117
| Auth Snippets | [source code](https://github.com/googleapis/java-bigquery/blob/main/samples/snippets/src/main/java/com/example/bigquery/AuthSnippets.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/AuthSnippets.java) |
119118
| Auth User Flow | [source code](https://github.com/googleapis/java-bigquery/blob/main/samples/snippets/src/main/java/com/example/bigquery/AuthUserFlow.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/AuthUserFlow.java) |
@@ -235,6 +234,7 @@ Samples are in the [`samples/`](https://github.com/googleapis/java-bigquery/tree
235234
| Update Dataset Expiration | [source code](https://github.com/googleapis/java-bigquery/blob/main/samples/snippets/src/main/java/com/example/bigquery/UpdateDatasetExpiration.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/UpdateDatasetExpiration.java) |
236235
| Update Dataset Partition Expiration | [source code](https://github.com/googleapis/java-bigquery/blob/main/samples/snippets/src/main/java/com/example/bigquery/UpdateDatasetPartitionExpiration.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/UpdateDatasetPartitionExpiration.java) |
237236
| Update Iam Policy | [source code](https://github.com/googleapis/java-bigquery/blob/main/samples/snippets/src/main/java/com/example/bigquery/UpdateIamPolicy.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/UpdateIamPolicy.java) |
237+
| Update Materialized View | [source code](https://github.com/googleapis/java-bigquery/blob/main/samples/snippets/src/main/java/com/example/bigquery/UpdateMaterializedView.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/UpdateMaterializedView.java) |
238238
| Update Model Description | [source code](https://github.com/googleapis/java-bigquery/blob/main/samples/snippets/src/main/java/com/example/bigquery/UpdateModelDescription.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/UpdateModelDescription.java) |
239239
| Update Routine | [source code](https://github.com/googleapis/java-bigquery/blob/main/samples/snippets/src/main/java/com/example/bigquery/UpdateRoutine.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/UpdateRoutine.java) |
240240
| Update Table Cmek | [source code](https://github.com/googleapis/java-bigquery/blob/main/samples/snippets/src/main/java/com/example/bigquery/UpdateTableCmek.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/UpdateTableCmek.java) |

samples/snippets/src/main/java/com/example/bigquery/AlterMaterializedView.java renamed to samples/snippets/src/main/java/com/example/bigquery/UpdateMaterializedView.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,25 @@
1616

1717
package com.example.bigquery;
1818

19-
// [START bigquery_alter_materialized_view]
19+
// [START bigquery_update_materialized_view]
2020
import com.google.cloud.bigquery.BigQuery;
2121
import com.google.cloud.bigquery.BigQueryException;
2222
import com.google.cloud.bigquery.BigQueryOptions;
2323
import com.google.cloud.bigquery.MaterializedViewDefinition;
2424
import com.google.cloud.bigquery.Table;
2525
import com.google.cloud.bigquery.TableId;
2626

27-
// Sample to alter materialized view
28-
public class AlterMaterializedView {
27+
// Sample to update materialized view
28+
public class UpdateMaterializedView {
2929

3030
public static void main(String[] args) {
3131
// TODO(developer): Replace these variables before running the sample.
3232
String datasetName = "MY_DATASET_NAME";
3333
String materializedViewName = "MY_MATERIALIZED_VIEW_NAME";
34-
alterMaterializedView(datasetName, materializedViewName);
34+
updateMaterializedView(datasetName, materializedViewName);
3535
}
3636

37-
public static void alterMaterializedView(String datasetName, String materializedViewName) {
37+
public static void updateMaterializedView(String datasetName, String materializedViewName) {
3838
try {
3939
// Initialize client that will be used to send requests. This client only needs to be created
4040
// once, and can be reused for multiple requests.
@@ -45,17 +45,17 @@ public static void alterMaterializedView(String datasetName, String materialized
4545
// Get existing materialized view
4646
Table table = bigquery.getTable(tableId);
4747
MaterializedViewDefinition materializedViewDefinition = table.getDefinition();
48-
// Alter materialized view
48+
// Update materialized view
4949
materializedViewDefinition
5050
.toBuilder()
5151
.setEnableRefresh(true)
5252
.setRefreshIntervalMs(1000L)
5353
.build();
5454
table.toBuilder().setDefinition(materializedViewDefinition).build().update();
55-
System.out.println("Materialized view altered successfully");
55+
System.out.println("Materialized view updated successfully");
5656
} catch (BigQueryException e) {
57-
System.out.println("Materialized view was not altered. \n" + e.toString());
57+
System.out.println("Materialized view was not updated. \n" + e.toString());
5858
}
5959
}
6060
}
61-
// [END bigquery_alter_materialized_view]
61+
// [END bigquery_update_materialized_view]

samples/snippets/src/test/java/com/example/bigquery/AlterMaterializedViewIT.java renamed to samples/snippets/src/test/java/com/example/bigquery/UpdateMaterializedViewIT.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import org.junit.BeforeClass;
3333
import org.junit.Test;
3434

35-
public class AlterMaterializedViewIT {
35+
public class UpdateMaterializedViewIT {
3636

3737
private static final String ID = UUID.randomUUID().toString().substring(0, 8);
3838
private final Logger log = Logger.getLogger(this.getClass().getName());
@@ -65,7 +65,7 @@ public void setUp() {
6565
System.setOut(out);
6666

6767
tableName = "MY_TABLE_NAME_TEST_" + ID;
68-
materializedViewName = "MY_ALTER_MATERIALIZED_VIEW_NAME_TEST_" + ID;
68+
materializedViewName = "MY_UPDATE_MATERIALIZED_VIEW_NAME_TEST_" + ID;
6969

7070
Schema schema =
7171
Schema.of(
@@ -95,8 +95,8 @@ public void tearDown() {
9595
}
9696

9797
@Test
98-
public void testAlterMaterializedView() {
99-
AlterMaterializedView.alterMaterializedView(BIGQUERY_DATASET_NAME, materializedViewName);
100-
assertThat(bout.toString()).contains("Materialized view altered successfully");
98+
public void testUpdateMaterializedView() {
99+
UpdateMaterializedView.updateMaterializedView(BIGQUERY_DATASET_NAME, materializedViewName);
100+
assertThat(bout.toString()).contains("Materialized view updated successfully");
101101
}
102102
}

0 commit comments

Comments
 (0)