時間単位列と整数範囲のパーティション分割テーブルの場合、デコレータで指定されたパーティション ID が、書き込まれるデータと一致する必要があります。たとえば、テーブルが DATE 列でパーティション分割されている場合は、デコレータがその列の値と一致する必要があります。一致していない場合は、エラーが発生します。ただし、データが単一のパーティション内にあることがわかっている場合は、パーティション デコレータを指定することで書き込みパフォーマンスを向上させることができます。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-09-04 UTC。"],[[["\u003cp\u003eData can be loaded into a specific partition of a table using the \u003ccode\u003ebq load\u003c/code\u003e command with a partition decorator, such as \u003ccode\u003e$20160501\u003c/code\u003e for the May 1, 2016 partition.\u003c/p\u003e\n"],["\u003cp\u003eQuery results can be written to a specific partition by using the \u003ccode\u003ebq query\u003c/code\u003e command and specifying the destination table with a partition decorator, along with appropriate flags.\u003c/p\u003e\n"],["\u003cp\u003ePartition 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.\u003c/p\u003e\n"],["\u003cp\u003eFor 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.\u003c/p\u003e\n"],["\u003cp\u003eData can be appended or overwritten in a partition by adjusting \u003ccode\u003ebq load\u003c/code\u003e or \u003ccode\u003ebq query\u003c/code\u003e flags.\u003c/p\u003e\n"]]],[],null,["# Load data into partitioned tables\n=================================\n\nThis document describes how to load data into partitioned tables.\n\nWrite data to a specific partition\n----------------------------------\n\nYou can load data to a specific partition by using the\n[`bq load`](/bigquery/docs/reference/bq-cli-reference#bq_load) command with a\npartition decorator. The following example appends data into the `20160501` (May\n1, 2016) partition of an existing table, assuming the table is already\npartitioned by date: \n\n```bash\nbq load --source_format=CSV 'my_dataset.my_table$20160501' data.csv\n```\n\nYou can also write the results of a query to a specific partition: \n\n```bash\nbq query \\\n --use_legacy_sql=false \\\n --destination_table='my_table$20160501' \\\n --append_table=true \\\n 'SELECT * FROM my_dataset.another_table'\n```\n\nWith ingestion-time partitioning, you can use this technique to load older data\ninto the partition that corresponds to the time when the data was originally\ncreated.\n\nYou can also use this technique to adjust for time zones. By default, ingestion-\ntime partitions are based on UTC time. If you want the partition time to match a\nparticular time zone, you can use partition decorators to offset the UTC\ningestion time. For example, if you are on Pacific Standard Time (PST), you can\nload data that was generated on May 1, 2016 23:30 PST into the partition for\nthat date by using the corresponding explicit partition decorator,\n`$2016050123`. If you didn't use this explicit decorator, it would instead load\ninto `$2016050207` (May 2nd 07:00 UTC).\n\nFor time-unit column and integer-range partitioned tables, the partition ID\nspecified in the decorator must match the data being written. For example, if\nthe table is partitioned on a `DATE` column, the decorator must match the value\nin that column. Otherwise, an error occurs. However, if you know beforehand that\nyour data is in a single partition, specifying the partition decorator can\nimprove write performance.\n\nThe preceding example appends data to a partition. To overwrite data in a\npartition instead, you must include different flags for each command, namely\n`bq load --replace=true ...` and `bq query --append_table=false ...`.\nFor more information about the flags in these commands, see [`bq load`](/bigquery/docs/reference/bq-cli-reference#bq_load)\nand [`bq query`](/bigquery/docs/reference/bq-cli-reference#bq_query).\n\nFor more information on loading data, see\n[Introduction to loading data into BigQuery](/bigquery/docs/loading-data).\n\nStream data into partitioned tables\n-----------------------------------\n\nFor information about streaming data into a partitioned table with the\nBigQuery Storage Write API, see\n[Stream into partitioned tables](/bigquery/docs/write-api#stream_into_partitioned_tables).\n\nWhat's next\n-----------\n\nTo learn more about working with partitioned tables, see:\n\n- [Creating partitioned tables](/bigquery/docs/creating-partitioned-tables)\n- [Managing partitioned tables](/bigquery/docs/managing-partitioned-tables)\n- [Querying partitioned tables](/bigquery/docs/querying-partitioned-tables)"]]