Skip to content

Commit

Permalink
[bigtable] Clean up quickstart comments and vars [(#1890)](GoogleClou…
Browse files Browse the repository at this point in the history
…dPlatform/python-docs-samples#1890)

Clean up comments and variable names as this quickstart will be sourced
directly into our quickstart docs.
  • Loading branch information
mbrukman authored and billyjacobson committed Dec 10, 2018
1 parent 7604ff7 commit 2d8d2da
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions samples/quickstart/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# [START bigtable_quickstart]
import argparse

Expand All @@ -21,23 +22,23 @@

def main(project_id="project-id", instance_id="instance-id",
table_id="my-table"):
# Creates a Bigtable client
# Create a Cloud Bigtable client.
client = bigtable.Client(project=project_id)

# Connect to an existing instance:my-bigtable-instance
# Connect to an existing Cloud Bigtable instance.
instance = client.instance(instance_id)

# Connect to an existing table:my-table
# Open an existing table.
table = instance.table(table_id)

key = 'r1'
row = table.read_row(key.encode('utf-8'))
row_key = 'r1'
row = table.read_row(row_key.encode('utf-8'))

column_family_id = 'cf1'
column_id = 'c1'.encode('utf-8')
value = row.cells[column_family_id][column_id][0].value.decode('utf-8')

print('Row key: {}\nData: {}'.format(key, value))
print('Row key: {}\nData: {}'.format(row_key, value))


if __name__ == '__main__':
Expand Down

0 comments on commit 2d8d2da

Please sign in to comment.