I would like to create a partitioned table(partition by field which is of DATE type) in BigQuery from java. I searched a lot but there is not much information on this. The code I used is
TimePartitioning timePartitioning = TimePartitioning.of(TimePartitioning.Type.DAY);
timePartitioning.toBuilder().setField("col3");
TableDefinition tableDefinition = StandardTableDefinition.newBuilder().setSchema(schema2).setTimePartitioning(timePartitioning).build();
TableInfo tableInfo = TableInfo.newBuilder(tableId, tableDefinition).build();
bigquery.create(tableInfo);
Here, I have a couple of questions
Easiest way would be to issue a standard query - if you can query from Java (which you already do?), just send a query like this:
#standardSQL
CREATE TABLE `project.dataset.table`
(
x INT64 OPTIONS(description="An optional INTEGER field"),
y STRUCT<
a ARRAY<STRING> OPTIONS(description="A repeated STRING field"),
b BOOL
>,
date_column DATE
)
PARTITION BY date_column
CLUSTER BY i_recommend_you_to_choose_a_clustering_column
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With