Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bigtable] Clean up quickstart comments and vars #1890

Merged
Merged
Changes from 1 commit
Commits
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
13 changes: 7 additions & 6 deletions bigtable/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