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

Document delay in table creation when insertAll is used with templateSuffix #522

Merged
merged 1 commit into from
Jan 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,16 @@ public Builder ignoreUnknownValues(boolean ignoreUnknownValues) {
/**
* If specified, the destination table is treated as a base template. Rows are inserted into an
* instance table named "{destination}{templateSuffix}". BigQuery will manage the creation of
* the instance table, using the schema of the base template table.
* the instance table, using the schema of the base template table. Table creation might take
* some time. To obtain table's information after {@link BigQuery#insertAll(InsertAllRequest)}
* is called use:
* <pre> {@code
* String suffixTableId = ...;
* BaseTableInfo suffixTable = bigquery.getTable(DATASET, suffixTableId);
* while (suffixTable == null) {
* Thread.sleep(1000L);
* suffixTable = bigquery.getTable(DATASET, suffixTableId);
* }}</pre>
*
* @see <a
* href="https://cloud.google.com/bigquery/streaming-data-into-bigquery#template-tables">
Expand Down Expand Up @@ -293,7 +302,16 @@ public Boolean skipInvalidRows() {
/**
* If specified, the destination table is treated as a base template. Rows are inserted into an
* instance table named "{destination}{templateSuffix}". BigQuery will manage the creation of the
* instance table, using the schema of the base template table.
* instance table, using the schema of the base template table. Table creation might take some
* time. To obtain table's information after {@link BigQuery#insertAll(InsertAllRequest)} is
* called use:
* <pre> {@code
* String suffixTableId = ...;
* BaseTableInfo suffixTable = bigquery.getTable(DATASET, suffixTableId);
* while (suffixTable == null) {
* Thread.sleep(1000L);
* suffixTable = bigquery.getTable(DATASET, suffixTableId);
* }}</pre>
*
* @see <a
* href="https://cloud.google.com/bigquery/streaming-data-into-bigquery#template-tables">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,11 +506,11 @@ public void testInsertAllWithSuffix() throws InterruptedException {
assertEquals(0, response.insertErrors().size());
String newTableName = tableName + "_suffix";
BaseTableInfo suffixTable = bigquery.getTable(DATASET, newTableName, TableOption.fields());
// wait until the new table is created. If the table is never created the test will time-out
while (suffixTable == null) {
Thread.sleep(1000L);
suffixTable = bigquery.getTable(DATASET, newTableName, TableOption.fields());
}
assertNotNull(suffixTable);
assertTrue(bigquery.delete(TableId.of(DATASET, tableName)));
assertTrue(bigquery.delete(TableId.of(DATASET, newTableName)));
}
Expand Down