Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove TableInfo hierarchy, add TableType hierarchy #600

Merged
merged 5 commits into from
Feb 2, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);

This comment was marked as spam.

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