Thanks for stopping by to let us know something could be better!
PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.
Please run down the following list and make sure you've tried the usual "quick fixes":
If you are still having issues, please be sure to include as much information as possible:
Environment details
- OS type and version: Debian GNU/Linux 11 (bullseye)
- Python version: Python 3.10.13
- pip version: pip 23.2.1
google-cloud-bigquery version: 3.11.4
Steps to reproduce
- Create an
AccessEntry through AccessEntry.from_api_repr without a role in the payload.
a. This is how the BigQuery API returns view type AccessEntrys.
- Create the same
AccessEntry through AccessEntry.__init__ with the equivalent resource.
- Compare the 2 for equality and get
False
Code example
from google.cloud.bigquery.dataset import AccessEntry
resource = {
'view': {
'projectId': 'my-project',
'datasetId': 'my_dataset',
'tableId': 'my_table',
}
}
api_repr_entry = AccessEntry.from_api_repr(resource)
expected_entry = AccessEntry(
entity_type='view',
entity_id=resource['view'],
)
print(api_repr_entry == expected_entry) # False
>>> print(api_repr_entry._properties) # {'view': {'projectId': 'my-project', 'datasetId': 'my_dataset', 'tableId': 'my_table'}}
>>> print(expected_entry._properties) # {'view': {'projectId': 'my-project', 'datasetId': 'my_dataset', 'tableId': 'my_table'}, 'role': None}
The entry created through AccessEntry.__init__ has 'role': None in its AccessEntry#_properties while the one from AccessEntry.from_api_repr does not causing the equality to fail. This is due to the _properties being overwritten with the API resource which doesn't include the role key when it's null.
Making sure to follow these steps will guarantee the quickest resolution possible.
Thanks!
Thanks for stopping by to let us know something could be better!
PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.
Please run down the following list and make sure you've tried the usual "quick fixes":
If you are still having issues, please be sure to include as much information as possible:
Environment details
google-cloud-bigqueryversion: 3.11.4Steps to reproduce
AccessEntrythroughAccessEntry.from_api_reprwithout a role in the payload.a. This is how the BigQuery API returns
viewtypeAccessEntrys.AccessEntrythroughAccessEntry.__init__with the equivalent resource.FalseCode example
The entry created through
AccessEntry.__init__has'role': Nonein itsAccessEntry#_propertieswhile the one fromAccessEntry.from_api_reprdoes not causing the equality to fail. This is due to the_propertiesbeing overwritten with the API resource which doesn't include therolekey when it'snull.Making sure to follow these steps will guarantee the quickest resolution possible.
Thanks!