Skip to content

Commit 9090e1c

Browse files
tswaststeffnay
andauthored
feat: add constants for MONTH and YEAR time partitioning types (#283)
Co-authored-by: Steffany Brown <[email protected]>
1 parent 9da28e5 commit 9090e1c

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

google/cloud/bigquery/table.py

+21-4
Original file line numberDiff line numberDiff line change
@@ -1980,20 +1980,37 @@ class TimePartitioningType(object):
19801980
HOUR = "HOUR"
19811981
"""str: Generates one partition per hour."""
19821982

1983+
MONTH = "MONTH"
1984+
"""str: Generates one partition per month."""
1985+
1986+
YEAR = "YEAR"
1987+
"""str: Generates one partition per year."""
1988+
19831989

19841990
class TimePartitioning(object):
19851991
"""Configures time-based partitioning for a table.
19861992
19871993
Args:
19881994
type_ (Optional[google.cloud.bigquery.table.TimePartitioningType]):
19891995
Specifies the type of time partitioning to perform. Defaults to
1990-
:attr:`~google.cloud.bigquery.table.TimePartitioningType.DAY`,
1991-
which is the only currently supported type.
1996+
:attr:`~google.cloud.bigquery.table.TimePartitioningType.DAY`.
1997+
1998+
Supported values are:
1999+
2000+
* :attr:`~google.cloud.bigquery.table.TimePartitioningType.HOUR`
2001+
* :attr:`~google.cloud.bigquery.table.TimePartitioningType.DAY`
2002+
* :attr:`~google.cloud.bigquery.table.TimePartitioningType.MONTH`
2003+
* :attr:`~google.cloud.bigquery.table.TimePartitioningType.YEAR`
2004+
19922005
field (Optional[str]):
19932006
If set, the table is partitioned by this field. If not set, the
19942007
table is partitioned by pseudo column ``_PARTITIONTIME``. The field
1995-
must be a top-level ``TIMESTAMP`` or ``DATE`` field. Its mode must
1996-
be ``NULLABLE`` or ``REQUIRED``.
2008+
must be a top-level ``TIMESTAMP``, ``DATETIME``, or ``DATE``
2009+
field. Its mode must be ``NULLABLE`` or ``REQUIRED``.
2010+
2011+
See the `time-unit column-partitioned tables guide
2012+
<https://cloud.google.com/bigquery/docs/creating-column-partitions>`_
2013+
in the BigQuery documentation.
19972014
expiration_ms(Optional[int]):
19982015
Number of milliseconds for which to keep the storage for a
19992016
partition.

0 commit comments

Comments
 (0)