diff --git a/google/cloud/bigquery/dataset.py b/google/cloud/bigquery/dataset.py index 114f0de18..a9c1cd884 100644 --- a/google/cloud/bigquery/dataset.py +++ b/google/cloud/bigquery/dataset.py @@ -769,9 +769,10 @@ def storage_billing_model(self): """Union[str, None]: StorageBillingModel of the dataset as set by the user (defaults to :data:`None`). - Set the value to one of ``'LOGICAL'`` or ``'PHYSICAL'``. This change - takes 24 hours to take effect and you must wait 14 days before you can - change the storage billing model again. + Set the value to one of ``'LOGICAL'``, ``'PHYSICAL'``, or + ``'STORAGE_BILLING_MODEL_UNSPECIFIED'``. This change takes 24 hours to + take effect and you must wait 14 days before you can change the storage + billing model again. See `storage billing model `_ @@ -788,13 +789,11 @@ def storage_billing_model(self): def storage_billing_model(self, value): if not isinstance(value, str) and value is not None: raise ValueError( - "storage_billing_model must be a string (e.g. 'LOGICAL', 'PHYSICAL'), or None. " - f"Got {repr(value)}." + "storage_billing_model must be a string (e.g. 'LOGICAL'," + " 'PHYSICAL', 'STORAGE_BILLING_MODEL_UNSPECIFIED'), or None." + f" Got {repr(value)}." ) - if value: - self._properties["storageBillingModel"] = value - if value is None: - self._properties["storageBillingModel"] = "LOGICAL" + self._properties["storageBillingModel"] = value @classmethod def from_string(cls, full_dataset_id: str) -> "Dataset": diff --git a/tests/unit/test_dataset.py b/tests/unit/test_dataset.py index f2bdf8db5..3b1452805 100644 --- a/tests/unit/test_dataset.py +++ b/tests/unit/test_dataset.py @@ -955,7 +955,7 @@ def test_storage_billing_model_setter(self): def test_storage_billing_model_setter_with_none(self): dataset = self._make_one(self.DS_REF) dataset.storage_billing_model = None - self.assertEqual(dataset.storage_billing_model, "LOGICAL") + self.assertIsNone(dataset.storage_billing_model) def test_storage_billing_model_setter_with_invalid_type(self): dataset = self._make_one(self.DS_REF)