diff --git a/google/cloud/bigquery/dataset.py b/google/cloud/bigquery/dataset.py index b7fed61c7..0f1a0f3cc 100644 --- a/google/cloud/bigquery/dataset.py +++ b/google/cloud/bigquery/dataset.py @@ -501,9 +501,7 @@ def from_api_repr(cls, resource: dict) -> "AccessEntry": if len(entry) != 0: raise ValueError("Entry has unexpected keys remaining.", entry) - config = cls(role, entity_type, entity_id) - config._properties = copy.deepcopy(resource) - return config + return cls(role, entity_type, entity_id) class Dataset(object): diff --git a/tests/unit/test_dataset.py b/tests/unit/test_dataset.py index 7d7091092..0a709ab43 100644 --- a/tests/unit/test_dataset.py +++ b/tests/unit/test_dataset.py @@ -152,6 +152,22 @@ def test_from_api_repr_w_unknown_entity_type(self): exp_resource = entry.to_api_repr() self.assertEqual(resource, exp_resource) + def test_from_api_repr_wo_role(self): + resource = { + "view": { + "projectId": "my-project", + "datasetId": "my_dataset", + "tableId": "my_table", + } + } + entry = self._get_target_class().from_api_repr(resource) + exp_entry = self._make_one( + role=None, + entity_type="view", + entity_id=resource["view"], + ) + self.assertEqual(entry, exp_entry) + def test_to_api_repr_w_extra_properties(self): resource = { "role": "READER",