public class BigqueryClient
extends java.lang.Object
Example:
Get a new Bigquery client:
[
BigqueryClient client = BigqueryClient.getNewBigquerryClient(applicationName);
]
Execute a query with retries:
[
QueryResponse response = client.queryWithRetries(queryString, projectId);
]
Create a new dataset in one project:
[
client.createNewDataset(projectId, datasetId);
]
Delete a dataset in one project, included its all tables:
[
client.deleteDataset(projectId, datasetId);
]
Create a new table
[
client.createNewTable(projectId, datasetId, newTable)
]
Insert data into table
[
client.insertDataToTable(projectId, datasetId, tableName, rows)
]
Constructor and Description |
---|
BigqueryClient(java.lang.String applicationName) |
Modifier and Type | Method and Description |
---|---|
void |
createNewDataset(java.lang.String projectId,
java.lang.String datasetId) |
void |
createNewTable(java.lang.String projectId,
java.lang.String datasetId,
Table newTable) |
void |
deleteDataset(java.lang.String projectId,
java.lang.String datasetId) |
void |
deleteTable(java.lang.String projectId,
java.lang.String datasetId,
java.lang.String tableName) |
static BigqueryClient |
getClient(java.lang.String applicationName) |
static Bigquery |
getNewBigquerryClient(java.lang.String applicationName) |
void |
insertDataToTable(java.lang.String projectId,
java.lang.String datasetId,
java.lang.String tableName,
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> rows) |
java.util.List<TableRow> |
queryUnflattened(java.lang.String query,
java.lang.String projectId,
boolean typed) |
QueryResponse |
queryWithRetries(java.lang.String query,
java.lang.String projectId) |
QueryResponse |
queryWithRetries(java.lang.String query,
java.lang.String projectId,
boolean typed) |
public static Bigquery getNewBigquerryClient(java.lang.String applicationName)
public static BigqueryClient getClient(java.lang.String applicationName)
@Nonnull public QueryResponse queryWithRetries(java.lang.String query, java.lang.String projectId) throws java.io.IOException, java.lang.InterruptedException
java.io.IOException
java.lang.InterruptedException
@Nonnull public java.util.List<TableRow> queryUnflattened(java.lang.String query, java.lang.String projectId, boolean typed) throws java.io.IOException, java.lang.InterruptedException
java.io.IOException
java.lang.InterruptedException
@Nonnull public QueryResponse queryWithRetries(java.lang.String query, java.lang.String projectId, boolean typed) throws java.io.IOException, java.lang.InterruptedException
java.io.IOException
java.lang.InterruptedException
public void createNewDataset(java.lang.String projectId, java.lang.String datasetId) throws java.io.IOException, java.lang.InterruptedException
java.io.IOException
java.lang.InterruptedException
public void deleteTable(java.lang.String projectId, java.lang.String datasetId, java.lang.String tableName)
public void deleteDataset(java.lang.String projectId, java.lang.String datasetId)
public void createNewTable(java.lang.String projectId, java.lang.String datasetId, Table newTable) throws java.io.IOException, java.lang.InterruptedException
java.io.IOException
java.lang.InterruptedException
public void insertDataToTable(java.lang.String projectId, java.lang.String datasetId, java.lang.String tableName, java.util.List<java.util.Map<java.lang.String,java.lang.Object>> rows) throws java.io.IOException, java.lang.InterruptedException
java.io.IOException
java.lang.InterruptedException