googleapis / python-bigtable

Apache License 2.0
68 stars 58 forks source link

Backup name format does not match the Bigtable Admin API #969

Closed AmitMatsil closed 4 months ago

AmitMatsil commented 4 months ago

The regular expression used in backup.py does not match the format specified in the Bigtable Admin API.

Environment details

Steps to reproduce

  1. Create a Bigtable table instance
  2. Call the list_backup method

Code example

from google.cloud import bigtable

client = bigtable.Client(admin=True, project='XXXX')
instance = client.instance('XXXX')
instance.table('_locks_').list_backups()

Stack trace

Traceback (most recent call last):
  File "XXX/bigtable_regex_error.py", line 5, in <module>
    instance.table('_locks_').list_backups()
  File "XXX/venv/lib/python3.11/site-packages/google/cloud/bigtable/table.py", line 1000, in list_backups
    result.append(Backup.from_pb(backup_pb, self._instance))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "XXX/venv/lib/python3.11/site-packages/google/cloud/bigtable/backup.py", line 253, in from_pb
    raise ValueError(
ValueError: ('Backup protobuf name was not in the expected format.', 'projects/XXXX/instances/XXXX/clusters/XXXX/backups/_locks_-backup-20240527-0700')
AmitMatsil commented 4 months ago

PR created https://github.com/googleapis/python-bigtable/pull/970.