Google-cloud-python: Bigtable: Instance object cannot create a Table with app profile

Created on 12 Jul 2018  路  2Comments  路  Source: googleapis/google-cloud-python

The Instance object has a method table() which only takes a table id, but not an app profile. This means it's not possible to create a Table object given an instance to be used with app profiles, even though the Table object constructor does take an optional app profile parameter.

Thus, instead of a simple quickstart as follows:

from google.cloud import bigtable

# Warning: this code doesn't work (yet)
client = bigtable.Client(project=project_id)
instance = client.instance(instance_id)
table = instance.table(table_id, app_profile_id)    # clean, simple; alas, does not work

we have to do something slightly round-about:

from google.cloud import bigtable

client = bigtable.Client(project=project_id)
instance = client.instance(instance_id)
table = bigtable.table.Table(table_id, instance, app_profile_id)   # awkward

Proposal: extend Instance#table() to take an optional app_profile_id parameter that would be forwarded to the Table constructor and hence allow the simpler code pattern above.

Thoughts?

/cc: @sduskis, @billyjacobson, @jabubake, @ghaisa

feature request bigtable p1

Most helpful comment

FTR, closed via #5605.

All 2 comments

Basically, instasnce.table() needs an optional app_profile_id parameter.

FTR, closed via #5605.

Was this page helpful?
0 / 5 - 0 ratings