Skip to content

Commit 6e35d09

Browse files
shollymanplamut
authored andcommitted
feat: add HOUR support for time partitioning interval (#91)
* feat: add HOUR support for time partitioning interval
1 parent c6e0133 commit 6e35d09

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
@@ -590,8 +590,6 @@ def partitioning_type(self):
590590
"""Union[str, None]: Time partitioning of the table if it is
591591
partitioned (Defaults to :data:`None`).
592592
593-
The only partitioning type that is currently supported is
594-
:attr:`~google.cloud.bigquery.table.TimePartitioningType.DAY`.
595593
"""
596594
warnings.warn(
597595
"This method will be deprecated in future versions. Please use "
@@ -1993,6 +1991,9 @@ class TimePartitioningType(object):
19931991
DAY = "DAY"
19941992
"""str: Generates one partition per day."""
19951993

1994+
HOUR = "HOUR"
1995+
"""str: Generates one partition per hour."""
1996+
19961997

19971998
class TimePartitioning(object):
19981999
"""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
@@ -1030,11 +1030,11 @@ def test_time_partitioning_setter(self):
10301030
dataset = DatasetReference(self.PROJECT, self.DS_ID)
10311031
table_ref = dataset.table(self.TABLE_NAME)
10321032
table = self._make_one(table_ref)
1033-
time_partitioning = TimePartitioning(type_=TimePartitioningType.DAY)
1033+
time_partitioning = TimePartitioning(type_=TimePartitioningType.HOUR)
10341034

10351035
table.time_partitioning = time_partitioning
10361036

1037-
self.assertEqual(table.time_partitioning.type_, TimePartitioningType.DAY)
1037+
self.assertEqual(table.time_partitioning.type_, TimePartitioningType.HOUR)
10381038
# Both objects point to the same properties dict
10391039
self.assertIs(
10401040
table._properties["timePartitioning"], time_partitioning._properties

0 commit comments

Comments
 (0)