Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a list of keys from Cloud Bigtable cbt tool?

I am using cbt tool to inspect the data of some tables. I want to know what are the typical fields in the rows of my table. The only way to do this is to use cbt read. But cbt read select massive amounts of rows, which I don't want to do. I just want to find a few row keys so I can run cbt lookup <row-key> with them.

I'm doing this because BigTable is simply an enterprise-class HBase, thus it is a schema-less DB. The only way to find out the columns of the table is to inspect the records.

like image 541
Calicoder Avatar asked Nov 20 '25 07:11

Calicoder


1 Answers

To avoid massive read amount of rows and select few row keys only, you can use [start=<row-key>] and [end=<row-key>] or with count=<n> to limit the number of rows read, here's the documentation.

For example, using [start=<row-key>] and [end=<row-key>] :

cbt read my-table start=r2 end=r4

output:

----------------------------------------
r2
  cf1:c1                                   @ 2021/08/24-02:34:56.750000
    "test2-value2"
----------------------------------------
r3
  cf1:c1                                   @ 2021/08/24-02:38:36.748000
    "test3-value3"

with count=<n>:

cbt read my-table start=r2 end=r4 count=1

output:

----------------------------------------
r2
  cf1:c1                                   @ 2021/08/24-02:34:56.750000
    "test2-value2"
like image 104
JM Gelilio Avatar answered Nov 22 '25 03:11

JM Gelilio



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!