Skip to content

Commit c010bc8

Browse files
committed
Remove TableInfo hierarchy, add TableType hierarchy
1 parent b4bddff commit c010bc8

30 files changed

Lines changed: 1351 additions & 1312 deletions

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ BaseTableInfo info = bigquery.getTable(tableId);
141141
if (info == null) {
142142
System.out.println("Creating table " + tableId);
143143
Field integerField = Field.of("fieldName", Field.Type.integer());
144-
bigquery.create(TableInfo.of(tableId, Schema.of(integerField)));
144+
Schema schema = Schema.of(integerField);
145+
bigquery.create(TableInfo.of(tableId, DefaultTableType.of(schema)));
145146
} else {
146147
System.out.println("Loading data into table " + tableId);
147148
LoadJobConfiguration configuration = LoadJobConfiguration.of(tableId, "gs://bucket/path");

gcloud-java-bigquery/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ are created from a BigQuery SQL query. In this code snippet we show how to creat
111111
with only one string field. Add the following imports at the top of your file:
112112

113113
```java
114-
import com.google.gcloud.bigquery.BaseTableInfo;
114+
import com.google.gcloud.bigquery.DefaultTableType;
115115
import com.google.gcloud.bigquery.Field;
116116
import com.google.gcloud.bigquery.Schema;
117117
import com.google.gcloud.bigquery.TableId;
@@ -126,7 +126,8 @@ Field stringField = Field.of("StringField", Field.Type.string());
126126
// Table schema definition
127127
Schema schema = Schema.of(stringField);
128128
// Create a table
129-
TableInfo createdTableInfo = bigquery.create(TableInfo.of(tableId, schema));
129+
DefaultTableType tableType = DefaultTableType.of(schema);
130+
TableInfo createdTableInfo = bigquery.create(TableInfo.of(tableId, tableType));
130131
```
131132

132133
#### Loading data into a table
@@ -204,10 +205,10 @@ the code from the main method to your application's servlet class and change the
204205
display on your webpage.
205206

206207
```java
207-
import com.google.gcloud.bigquery.BaseTableInfo;
208208
import com.google.gcloud.bigquery.BigQuery;
209209
import com.google.gcloud.bigquery.BigQueryOptions;
210210
import com.google.gcloud.bigquery.DatasetInfo;
211+
import com.google.gcloud.bigquery.DefaultTableType;
211212
import com.google.gcloud.bigquery.Field;
212213
import com.google.gcloud.bigquery.FieldValue;
213214
import com.google.gcloud.bigquery.InsertAllRequest;
@@ -240,7 +241,8 @@ public class GcloudBigQueryExample {
240241
// Table schema definition
241242
Schema schema = Schema.of(stringField);
242243
// Create a table
243-
TableInfo createdTableInfo = bigquery.create(TableInfo.of(tableId, schema));
244+
DefaultTableType tableType = DefaultTableType.of(schema);
245+
TableInfo createdTableInfo = bigquery.create(TableInfo.of(tableId, tableType));
244246

245247
// Define rows to insert
246248
Map<String, Object> firstRow = new HashMap<>();

0 commit comments

Comments
 (0)