After creating a :class:`Cluster <gcloud.bigtable.cluster.Cluster>`, you can interact with individual tables, groups of tables or column families within a table.
If you want a comprehensive list of all existing tables in a cluster, make a ListTables API request with :meth:`Cluster.list_tables() <gcloud.bigtable.cluster.Cluster.list_tables>`:
>>> cluster.list_tables()
[<gcloud.bigtable.table.Table at 0x7ff6a1de8f50>,
<gcloud.bigtable.table.Table at 0x7ff6a1de8350>]To create a :class:`Table <gcloud.bigtable.table.Table>` object:
table = cluster.table(table_id)Even if this :class:`Table <gcloud.bigtable.table.Table>` already has been created with the API, you'll want this object to use as a parent of a :class:`ColumnFamily <gcloud.bigtable.column_family.ColumnFamily>` or :class:`Row <gcloud.bigtable.row.Row>`.
After creating the table object, make a CreateTable API request with :meth:`create() <gcloud.bigtable.table.Table.create>`:
table.create()If you would to initially split the table into several tablets (Tablets are similar to HBase regions):
table.create(initial_split_keys=['s1', 's2'])Make a DeleteTable API request with :meth:`delete() <gcloud.bigtable.table.Table.delete>`:
table.delete()Though the RenameTable API request is listed in the service definition, requests to that method return:
BigtableTableService.RenameTable is not yet implemented
We have implemented :meth:`rename() <gcloud.bigtable.table.Table.rename>` but it will not work unless the backend supports the method.
Though there is no official method for retrieving column families associated with a table, the GetTable API method returns a table object with the names of the column families.
To retrieve the list of column families use :meth:`list_column_families() <gcloud.bigtable.table.Table.list_column_families>`:
column_families = table.list_column_families()To create a :class:`ColumnFamily <gcloud.bigtable.column_family.ColumnFamily>` object:
column_family = table.column_family(column_family_id)There is no real reason to use this factory unless you intend to create or delete a column family.
In addition, you can specify an optional gc_rule (a
:class:`GarbageCollectionRule <gcloud.bigtable.column_family.GarbageCollectionRule>`
or similar):
column_family = table.column_family(column_family_id,
gc_rule=gc_rule)This rule helps the backend determine when and how to clean up old cells in the column family.
See :doc:`bigtable-column-family` for more information about :class:`GarbageCollectionRule <gcloud.bigtable.column_family.GarbageCollectionRule>` and related classes.
After creating the column family object, make a CreateColumnFamily API request with :meth:`ColumnFamily.create() <gcloud.bigtable.column_family.ColumnFamily.create>`
column_family.create()Make a DeleteColumnFamily API request with :meth:`ColumnFamily.delete() <gcloud.bigtable.column_family.ColumnFamily.delete>`
column_family.delete()Make an UpdateColumnFamily API request with :meth:`ColumnFamily.delete() <gcloud.bigtable.column_family.ColumnFamily.update>`
column_family.update()Now we go down the final step of the hierarchy from :class:`Table <gcloud.bigtable.table.Table>` to :class:`Row <gcloud.bigtable.row.Row>` as well as streaming data directly via a :class:`Table <gcloud.bigtable.table.Table>`.
Head next to learn about the :doc:`bigtable-data-api`.