Skip to content

Commit

Permalink
Remove TableInfo hierarchy, add TableType hierarchy
Browse files Browse the repository at this point in the history
  • Loading branch information
mziccard committed Jan 29, 2016
1 parent b4bddff commit c010bc8
Show file tree
Hide file tree
Showing 30 changed files with 1,351 additions and 1,312 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ BaseTableInfo info = bigquery.getTable(tableId);
if (info == null) {
System.out.println("Creating table " + tableId);
Field integerField = Field.of("fieldName", Field.Type.integer());
bigquery.create(TableInfo.of(tableId, Schema.of(integerField)));
Schema schema = Schema.of(integerField);
bigquery.create(TableInfo.of(tableId, DefaultTableType.of(schema)));
} else {
System.out.println("Loading data into table " + tableId);
LoadJobConfiguration configuration = LoadJobConfiguration.of(tableId, "gs://bucket/path");
Expand Down
10 changes: 6 additions & 4 deletions gcloud-java-bigquery/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ are created from a BigQuery SQL query. In this code snippet we show how to creat
with only one string field. Add the following imports at the top of your file:

```java
import com.google.gcloud.bigquery.BaseTableInfo;
import com.google.gcloud.bigquery.DefaultTableType;
import com.google.gcloud.bigquery.Field;
import com.google.gcloud.bigquery.Schema;
import com.google.gcloud.bigquery.TableId;
Expand All @@ -126,7 +126,8 @@ Field stringField = Field.of("StringField", Field.Type.string());
// Table schema definition
Schema schema = Schema.of(stringField);
// Create a table
TableInfo createdTableInfo = bigquery.create(TableInfo.of(tableId, schema));
DefaultTableType tableType = DefaultTableType.of(schema);
TableInfo createdTableInfo = bigquery.create(TableInfo.of(tableId, tableType));
```

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

```java
import com.google.gcloud.bigquery.BaseTableInfo;
import com.google.gcloud.bigquery.BigQuery;
import com.google.gcloud.bigquery.BigQueryOptions;
import com.google.gcloud.bigquery.DatasetInfo;
import com.google.gcloud.bigquery.DefaultTableType;
import com.google.gcloud.bigquery.Field;
import com.google.gcloud.bigquery.FieldValue;
import com.google.gcloud.bigquery.InsertAllRequest;
Expand Down Expand Up @@ -240,7 +241,8 @@ public class GcloudBigQueryExample {
// Table schema definition
Schema schema = Schema.of(stringField);
// Create a table
TableInfo createdTableInfo = bigquery.create(TableInfo.of(tableId, schema));
DefaultTableType tableType = DefaultTableType.of(schema);
TableInfo createdTableInfo = bigquery.create(TableInfo.of(tableId, tableType));

// Define rows to insert
Map<String, Object> firstRow = new HashMap<>();
Expand Down
Loading

0 comments on commit c010bc8

Please sign in to comment.