A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developers.google.com/bigquery/docs/load-data-partitioned-tables below:

Load data into partitioned tables | BigQuery

Stay organized with collections Save and categorize content based on your preferences.

Load data into partitioned tables

This document describes how to load data into partitioned tables.

Write data to a specific partition

You can load data to a specific partition by using the bq load command with a partition decorator. The following example appends data into the 20160501 (May 1, 2016) partition of an existing table, assuming the table is already partitioned by date:

bq load --source_format=CSV 'my_dataset.my_table$20160501' data.csv

You can also write the results of a query to a specific partition:

bq query \
  --use_legacy_sql=false  \
  --destination_table='my_table$20160501' \
  --append_table=true \
  'SELECT * FROM my_dataset.another_table'

With ingestion-time partitioning, you can use this technique to load older data into the partition that corresponds to the time when the data was originally created.

You can also use this technique to adjust for time zones. By default, ingestion- time partitions are based on UTC time. If you want the partition time to match a particular time zone, you can use partition decorators to offset the UTC ingestion time. For example, if you are on Pacific Standard Time (PST), you can load data that was generated on May 1, 2016 23:30 PST into the partition for that date by using the corresponding explicit partition decorator, $2016050123. If you didn't use this explicit decorator, it would instead load into $2016050207 (May 2nd 07:00 UTC).

For time-unit column and integer-range partitioned tables, the partition ID specified in the decorator must match the data being written. For example, if the table is partitioned on a DATE column, the decorator must match the value in that column. Otherwise, an error occurs. However, if you know beforehand that your data is in a single partition, specifying the partition decorator can improve write performance.

The preceding example appends data to a partition. To overwrite data in a partition instead, you must include different flags for each command, namely bq load --replace=true ... and bq query --append_table=false .... For more information about the flags in these commands, see bq load and bq query.

For more information on loading data, see Introduction to loading data into BigQuery.

Stream data into partitioned tables

For information about streaming data into a partitioned table with the BigQuery Storage Write API, see Stream into partitioned tables.

What's next

To learn more about working with partitioned tables, see:

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["Data can be loaded into a specific partition of a table using the `bq load` command with a partition decorator, such as `$20160501` for the May 1, 2016 partition."],["Query results can be written to a specific partition by using the `bq query` command and specifying the destination table with a partition decorator, along with appropriate flags."],["Partition decorators can be used with ingestion-time partitioning to load older data into the correct partition or to adjust for time zone differences, by loading the data into a partition reflecting the correct time."],["For time-unit column and integer-range partitioned tables, the partition ID specified in the decorator must align with the data being written to avoid errors, although it can improve write performance."],["Data can be appended or overwritten in a partition by adjusting `bq load` or `bq query` flags."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4