Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
69cde27
[new] managed backup wrappers + unit tests
mf2199 Jun 18, 2020
1452ab6
feat: managed backups wrappers
mf2199 Jun 18, 2020
84390ed
Merge branch 'managed-backups' of https://github.com/q-logic/python-b…
mf2199 Jun 18, 2020
b019cbe
fix: docstrings + blacken
mf2199 Jun 18, 2020
303a202
fix: cleanup
mf2199 Jun 22, 2020
e7edc3d
refactor: ``backup``, ``list_backups`` and ``retore_table`` methods m…
mf2199 Jun 23, 2020
c7f5a25
feat: `reaload` and `is_ready` methods removed
mf2199 Jun 23, 2020
5cfb1fc
refactor: `re` parser made local
mf2199 Jun 23, 2020
d3a121a
feat: integration test
mf2199 Jun 24, 2020
e58a8e1
refactor: cleanup
mf2199 Jun 24, 2020
3a00c77
fix: format
mf2199 Jun 25, 2020
d472fc6
refactor: `name`, `cluster` property getters & `table_list_backups`
mf2199 Jun 28, 2020
38c6798
refactor: using `BigtableTableAdminClient.table_path` in lieu of `for…
mf2199 Jun 29, 2020
b25ac9b
fix: `from_pb2` method to include all `backup_pb` fields
mf2199 Jun 29, 2020
ecf35d7
refactor: cleanup
mf2199 Jun 29, 2020
d638a09
format: blacken
mf2199 Jun 30, 2020
db2421b
Merge branch 'master' into managed-backups
mf2199 Jul 2, 2020
8404c89
feat: reinstated `Backup.reload` + test method
mf2199 Jul 8, 2020
6f64861
fix: docstring typos
mf2199 Jul 14, 2020
c291d8c
cleanup: minor cleanup
mf2199 Jul 17, 2020
69c4d4f
cleanup: minor cleanup
mf2199 Jul 20, 2020
0a015d1
fix: ASCII encoding
mf2199 Jul 20, 2020
f76e17a
fix: Python 2 compatibility issue
mf2199 Jul 21, 2020
2376562
fix: SphinxWarning [possible cause]
mf2199 Jul 21, 2020
48c933f
fix: lint errors
mf2199 Jul 21, 2020
1607448
Merge branch 'master' into managed-backups
mf2199 Jul 21, 2020
ea43ae0
Merge branch 'master' into managed-backups
kolea2 Jul 21, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: using BigtableTableAdminClient.table_path in lieu of `for…
…mat`
  • Loading branch information
mf2199 committed Jun 29, 2020
commit 38c6798f73ee42a61c8ffef7b913cafb9ff05731
9 changes: 7 additions & 2 deletions google/cloud/bigtable/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,13 @@ def source_table(self):
:returns: The Table name.
"""
if not self._source_table and self.table_id:
self._source_table = "{}/tables/{}".format(
self._instance.name, self.table_id
# self._source_table = "{}/tables/{}".format(
# self._instance.name, self.table_id
# )
self._source_table = BigtableTableAdminClient.table_path(
project=self._instance._client.project,
instance=self._instance.instance_id,
table=self.table_id
)
return self._source_table

Expand Down
36 changes: 32 additions & 4 deletions tests/unit/test_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,43 @@ def test_property_parent_w_cluster(self):
self.assertEqual(backup.parent, self.CLUSTER_NAME)

def test_property_source_table_none(self):
instance = _Instance(self.INSTANCE_NAME)
backup = self._make_one(self.BACKUP_ID, instance)
from google.cloud.bigtable.client import Client
from google.cloud.bigtable_admin_v2.gapic import bigtable_table_admin_client

api = bigtable_table_admin_client.BigtableTableAdminClient(mock.Mock())
credentials = _make_credentials()
client = Client(
project=self.PROJECT_ID, credentials=credentials, admin=True
)
client._table_admin_client = api
instance = _Instance(self.INSTANCE_NAME, client)

backup = self._make_one(
self.BACKUP_ID,
instance
)
self.assertIsNone(backup.source_table)

def test_property_source_table_valid(self):
instance = _Instance(self.INSTANCE_NAME)
backup = self._make_one(self.BACKUP_ID, instance, table_id=self.TABLE_ID)
from google.cloud.bigtable.client import Client
from google.cloud.bigtable_admin_v2.gapic import bigtable_table_admin_client

api = bigtable_table_admin_client.BigtableTableAdminClient(mock.Mock())
credentials = _make_credentials()
client = Client(
project=self.PROJECT_ID, credentials=credentials, admin=True
)
client._table_admin_client = api
instance = _Instance(self.INSTANCE_NAME, client)

backup = self._make_one(
self.BACKUP_ID,
instance,
table_id=self.TABLE_ID
)
self.assertEqual(backup.source_table, self.TABLE_NAME)


def test_property_expire_time(self):
instance = _Instance(self.INSTANCE_NAME)
expire_time = self._make_timestamp()
Expand Down