Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions google/cloud/bigquery/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -1980,20 +1980,37 @@ class TimePartitioningType(object):
HOUR = "HOUR"
"""str: Generates one partition per hour."""

MONTH = "MONTH"
"""str: Generates one partition per month."""

YEAR = "YEAR"
"""str: Generates one partition per year."""


class TimePartitioning(object):
"""Configures time-based partitioning for a table.

Args:
type_ (Optional[google.cloud.bigquery.table.TimePartitioningType]):
Specifies the type of time partitioning to perform. Defaults to
:attr:`~google.cloud.bigquery.table.TimePartitioningType.DAY`,
which is the only currently supported type.
:attr:`~google.cloud.bigquery.table.TimePartitioningType.DAY`.

Supported values are:

* :attr:`~google.cloud.bigquery.table.TimePartitioningType.HOUR`
* :attr:`~google.cloud.bigquery.table.TimePartitioningType.DAY`
* :attr:`~google.cloud.bigquery.table.TimePartitioningType.MONTH`
* :attr:`~google.cloud.bigquery.table.TimePartitioningType.YEAR`

field (Optional[str]):
If set, the table is partitioned by this field. If not set, the
table is partitioned by pseudo column ``_PARTITIONTIME``. The field
must be a top-level ``TIMESTAMP`` or ``DATE`` field. Its mode must
be ``NULLABLE`` or ``REQUIRED``.
must be a top-level ``TIMESTAMP``, ``DATETIME``, or ``DATE``
field. Its mode must be ``NULLABLE`` or ``REQUIRED``.

See the `time-unit column-partitioned tables guide
<https://cloud.google.com/bigquery/docs/creating-column-partitions>`_
in the BigQuery documentation.
expiration_ms(Optional[int]):
Number of milliseconds for which to keep the storage for a
partition.
Expand Down