Skip to content

Commit 0dd90b9

Browse files
authored
feat: add HOUR support for time partitioning interval (#91)
* feat: add HOUR support for time partitioning interval
1 parent 834e2c0 commit 0dd90b9

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

google/cloud/bigquery/table.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,8 +583,6 @@ def partitioning_type(self):
583583
"""Union[str, None]: Time partitioning of the table if it is
584584
partitioned (Defaults to :data:`None`).
585585
586-
The only partitioning type that is currently supported is
587-
:attr:`~google.cloud.bigquery.table.TimePartitioningType.DAY`.
588586
"""
589587
warnings.warn(
590588
"This method will be deprecated in future versions. Please use "
@@ -1980,6 +1978,9 @@ class TimePartitioningType(object):
19801978
DAY = "DAY"
19811979
"""str: Generates one partition per day."""
19821980

1981+
HOUR = "HOUR"
1982+
"""str: Generates one partition per hour."""
1983+
19831984

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

tests/unit/test_table.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,11 +1024,11 @@ def test_time_partitioning_setter(self):
10241024
dataset = DatasetReference(self.PROJECT, self.DS_ID)
10251025
table_ref = dataset.table(self.TABLE_NAME)
10261026
table = self._make_one(table_ref)
1027-
time_partitioning = TimePartitioning(type_=TimePartitioningType.DAY)
1027+
time_partitioning = TimePartitioning(type_=TimePartitioningType.HOUR)
10281028

10291029
table.time_partitioning = time_partitioning
10301030

1031-
self.assertEqual(table.time_partitioning.type_, TimePartitioningType.DAY)
1031+
self.assertEqual(table.time_partitioning.type_, TimePartitioningType.HOUR)
10321032
# Both objects point to the same properties dict
10331033
self.assertIs(
10341034
table._properties["timePartitioning"], time_partitioning._properties

0 commit comments

Comments
 (0)