in upload.py [0:0]
def create_table(client: bigquery.Client):
table_ref = client.dataset(DATASET).table(TABLE_NAME)
table = bigquery.Table(table_ref, schema = TABLE_SCHEMA)
table._properties["tableConstraints"] = {}
table._properties["tableConstraints"]["primaryKey"] = {"columns": ["document_id"]}
# We can't add a foreign key because the ids may pertain to firefox_desktop or fenix tables.
table.time_partitioning = bigquery.TimePartitioning(
type_ = bigquery.TimePartitioningType.DAY,
field = "submission_timestamp",
# 775 days, matching the crash table
expiration_ms = 1000 * 60 * 60 * 24 * 775,
require_partition_filter = True,
)
client.create_table(table)