Content-Length: 345468 | pFad | http://github.com/googleapis/python-bigquery/commit/514d3e12e5131bd589dff08893fd89bf40338ba3

6D fix: allow `storage_billing_model` to be explicitly set to `None` to … · googleapis/python-bigquery@514d3e1 · GitHub
Skip to content

Commit 514d3e1

Browse files
authored
fix: allow storage_billing_model to be explicitly set to None to use project default value (#1665)
* fix: allow `storage_billing_model` to be explicitly set to `None` to use project default value * add STORAGE_BILLING_MODEL_UNSPECIFIED to docstring
1 parent 54a7769 commit 514d3e1

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

google/cloud/bigquery/dataset.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -769,9 +769,10 @@ def storage_billing_model(self):
769769
"""Union[str, None]: StorageBillingModel of the dataset as set by the user
770770
(defaults to :data:`None`).
771771
772-
Set the value to one of ``'LOGICAL'`` or ``'PHYSICAL'``. This change
773-
takes 24 hours to take effect and you must wait 14 days before you can
774-
change the storage billing model again.
772+
Set the value to one of ``'LOGICAL'``, ``'PHYSICAL'``, or
773+
``'STORAGE_BILLING_MODEL_UNSPECIFIED'``. This change takes 24 hours to
774+
take effect and you must wait 14 days before you can change the storage
775+
billing model again.
775776
776777
See `storage billing model
777778
<https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets#Dataset.FIELDS.storage_billing_model>`_
@@ -788,13 +789,11 @@ def storage_billing_model(self):
788789
def storage_billing_model(self, value):
789790
if not isinstance(value, str) and value is not None:
790791
raise ValueError(
791-
"storage_billing_model must be a string (e.g. 'LOGICAL', 'PHYSICAL'), or None. "
792-
f"Got {repr(value)}."
792+
"storage_billing_model must be a string (e.g. 'LOGICAL',"
793+
" 'PHYSICAL', 'STORAGE_BILLING_MODEL_UNSPECIFIED'), or None."
794+
f" Got {repr(value)}."
793795
)
794-
if value:
795-
self._properties["storageBillingModel"] = value
796-
if value is None:
797-
self._properties["storageBillingModel"] = "LOGICAL"
796+
self._properties["storageBillingModel"] = value
798797

799798
@classmethod
800799
def from_string(cls, full_dataset_id: str) -> "Dataset":

tests/unit/test_dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,7 @@ def test_storage_billing_model_setter(self):
955955
def test_storage_billing_model_setter_with_none(self):
956956
dataset = self._make_one(self.DS_REF)
957957
dataset.storage_billing_model = None
958-
self.assertEqual(dataset.storage_billing_model, "LOGICAL")
958+
self.assertIsNone(dataset.storage_billing_model)
959959

960960
def test_storage_billing_model_setter_with_invalid_type(self):
961961
dataset = self._make_one(self.DS_REF)

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/googleapis/python-bigquery/commit/514d3e12e5131bd589dff08893fd89bf40338ba3

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy