com.google.cloud.bigquery
A client for BigQuery – A fully managed, petabyte scale, low cost enterprise data warehouse for analytics.
A simple usage example showing how to create a table in Bigquery. For the complete source code see CreateTable.java.
{@code try { // Initialize client that will be used to send requests. This client only needs to be created // once, and can be reused for multiple requests. BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService();
TableId tableId = TableId.of(datasetName, tableName);
TableDefinition tableDefinition = StandardTableDefinition.of(schema);
TableInfo tableInfo = TableInfo.newBuilder(tableId, tableDefinition).build();
bigquery.create(tableInfo);
System.out.println("Table created successfully");
} catch (BigQueryException e) {
System.out.println("Table was not created.
" + e.toString()); }
See Also: Google Cloud BigQuery
com.google.cloud.bigquery.benchmark
com.google.cloud.bigquery.spi
com.google.cloud.bigquery.spi.v2
com.google.cloud.bigquery.testing
A testing helper for Google BigQuery.
A simple usage example: 1. Create a test Google Cloud project.
2. Download a JSON service account credentials file from the Google Developer's Console.
3. Create a RemoteBigQueryHelper object using your project ID and JSON key. Here is an example that uses the RemoteBigQueryHelper to create a dataset.
4. Run tests.
Before the test:
RemoteBigQueryHelper bigqueryHelper = RemoteBigQueryHelper.create();
BigQuery bigquery = bigqueryHelper.getOptions().getService();
String dataset = RemoteBigQueryHelper.generateDatasetName();
bigquery.create(DatasetInfo.newBuilder(dataset).build());
After the test:
RemoteBigQueryHelper.forceDelete(bigquery, DATASET);