Search code examples
google-cloud-bigtable

Can a google cloud bigtable table have just a rowkey?


Given a table with no column family since we want to store only the rowkey,

cbt ls alert_lut
Family Name     GC Policy
-----------     ---------

and an input file

head file.csv
185418825#1#ANT2018cjdkc
227156697#1#ANT2020jhyg4
3382811056#1#ANT2021kr2f2
54520783939#1#ANT2020wlymk
52841617510#1#ANT2019csrqk
49914774751#1#ANT2019ankba
266967569#1#ANT2020sqdmm
266967569#1#ANT2022643j2nii6jc8
53038301733#1#ANT2021vje4w

when running cbt import alert_lut file.csv it returns

2022/10/17 12:15:44 error parsing headers: at least 2 columns are required (rowkey + data)

I've tried adding a columnfamily and using

head file.csv
,
185418825#1#ANT2018cjdkc,
227156697#1#ANT2020jhyg4,
3382811056#1#ANT2021kr2f2,
54520783939#1#ANT2020wlymk,
52841617510#1#ANT2019csrqk,
49914774751#1#ANT2019ankba,

and it returns

2022/10/17 12:22:18 error parsing headers: the first column must be empty for column-family and column name rows

Solution

  • Bigtable tables do require a column family and column. One common approach for developers in this situation is to just use a single character for each. This takes up the least amount of space possible and shouldn't add too much extra overhead.

    An example would be column family a and column a