Is streaming data into a column-partitioned BigQuery table supported? I'm having trouble, getting this error:
BadRequest: 400 POST https://www.googleapis.com/bigquery/v2/projects/...$20180410/insertAll: Streaming to metadata partition of column based partitioning table ...$20180410 is disallowed.
Reading the BigQuery streaming documentation it says streaming to partitioned tables is allowed, but all examples are for the ingest-time partitions. I don't see reference to the newer column-based partitioning.
Is it supported and I'm just doing it wrong? For example, the error occurs when I explicitly add the partition suffix ($YYYYMMDD). When I don't use the suffix the write succeeds, but it doesn't look like it's actually partitioned.
Here's my sample code:
We have a table with a few columns, let's say this:
date: DATE (partitioned field)
name: STRING
count: INTEGER
I'm trying to do a streaming insert, via:
from google.cloud import bigquery
data = [
{'date': date('2018-04-10'), 'name': 'x', 'count': 10},
{'date': date('2018-04-10'), 'name': 'y', 'count': 5},
]
client = bigquery.Client(...)
table_ref = client.dataset(dataset).table(tableid + '$20180410')
schema = client.get_table(table_ref).schema
# Raises the 400 Bad Request above.
result = client.insert_rows(table_ref, data, selected_fields=schema)
bq rm ...$20180410
the rows are not removed. – Greg