-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
api: bigqueryIssues related to the BigQuery API.Issues related to the BigQuery API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
I am trying to follow these steps to query Bigtable data using a permanent table:
https://cloud.google.com/bigquery/external-data-bigtable#permanent-tables
The approach works quite well using the CLI, but I now have to implement it as part of our Java service.
Essentially, this is what I want to accomplish:
public Table createExternalTable(
String datasetName,
String tableName,
String sourceFormat,
String sourceUri,
Object columnFamilies) {
TableId tableId = TableId.of(datasetName, tableName);
FormatOptions bigTableFormatOptions = FormatOptions.bigtable();
//Issue 1: need to give this guy columnFamilies...
ExternalTableDefinition externalTableDefinition =
ExternalTableDefinition.newBuilder(sourceUri, Schema.of(), bigTableFormatOptions)
.build();
//Issue 2: I need to provide a schema for the builder, but I don't have/need one
//Issue 3: How do i set sourceFormat to BIGTABLE? No setter is provided by the builder
TableInfo tableInfo =
TableInfo.newBuilder(tableId, externalTableDefinition)
.build();
return bigquery.create(tableInfo);
}
To summarize, there are 3 issues I am trying to solve:
- Provide
columnFamiliesto the FormatOptions (Or BigtableOptions). This is critical, I cannot create my table without this... - Init a builder without having to provide a schema. For now I am just passing an empty one.
- Pass a
sourceFormatto theExternalTableDefinition, this is also critical and required.
I have spend a very long time sifting through the Google source code, but there does not appear to be a way to accomplish this currently.
Is there another way to create an ExternalTableDefinition programmatically?
Metadata
Metadata
Assignees
Labels
api: bigqueryIssues related to the BigQuery API.Issues related to the BigQuery API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.