本文整理汇总了Java中com.google.api.services.bigquery.model.Table.getTableReference方法的典型用法代码示例。如果您正苦于以下问题:Java Table.getTableReference方法的具体用法?Java Table.getTableReference怎么用?Java Table.getTableReference使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.api.services.bigquery.model.Table
的用法示例。
在下文中一共展示了Table.getTableReference方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTable
import com.google.api.services.bigquery.model.Table; //导入方法依赖的package包/类
@Override
public void createTable(Table table) throws IOException {
TableReference tableReference = table.getTableReference();
validateWholeTableReference(tableReference);
synchronized (tables) {
Map<String, TableContainer> dataset =
tables.get(tableReference.getProjectId(), tableReference.getDatasetId());
if (dataset == null) {
throwNotFound(
"Tried to get a dataset %s:%s, but no such table was set",
tableReference.getProjectId(),
tableReference.getDatasetId());
}
TableContainer tableContainer = dataset.get(tableReference.getTableId());
if (tableContainer == null) {
tableContainer = new TableContainer(table);
dataset.put(tableReference.getTableId(), tableContainer);
}
}
}
示例2: updateTable
import com.google.api.services.bigquery.model.Table; //导入方法依赖的package包/类
/**
* Updates the specified Bigquery table to reflect the metadata from the input.
*
* <p>Returns the input DestinationTable. If the specified table does not already exist, it will
* be inserted into the dataset.
*
* <p>Clients can call this function directly to update a table on demand, or can pass it to
* Futures.transform() to update a table produced as the asynchronous result of a load or query
* job (e.g. to add a description to it).
*/
private DestinationTable updateTable(final DestinationTable destinationTable) {
Table table = destinationTable.getTable();
TableReference ref = table.getTableReference();
try {
if (checkTableExists(ref.getDatasetId(), ref.getTableId())) {
// Make sure to use patch() rather than update(). The former changes only those properties
// which are specified, while the latter would change everything, blanking out unspecified
// properties.
bigquery
.tables()
.patch(ref.getProjectId(), ref.getDatasetId(), ref.getTableId(), table)
.execute();
} else {
bigquery.tables().insert(ref.getProjectId(), ref.getDatasetId(), table).execute();
}
return destinationTable;
} catch (IOException e) {
throw BigqueryJobFailureException.create(e);
}
}
示例3: updateTable
import com.google.api.services.bigquery.model.Table; //导入方法依赖的package包/类
private static void updateTable(Bigquery bigquery, Table table) throws IOException {
TableReference ref = table.getTableReference();
try {
bigquery
.tables()
.update(ref.getProjectId(), ref.getDatasetId(), ref.getTableId(), table)
.execute();
} catch (GoogleJsonResponseException e) {
if (e.getDetails().getCode() == 404) {
bigquery.tables().insert(ref.getProjectId(), ref.getDatasetId(), table).execute();
} else {
logger.warningfmt("UpdateSnapshotViewAction failed, caught exception %s", e.getDetails());
}
}
}
示例4: emptyTable
import com.google.api.services.bigquery.model.Table; //导入方法依赖的package包/类
void emptyTable(String projectId, Table table)
throws IOException
{
TableReference r = table.getTableReference();
deleteTable(r.getProjectId(), r.getDatasetId(), r.getTableId());
createTable(projectId, table);
}