arielorvits
arielorvits

Reputation: 5535

How to set the column family when inserting a row in Bigtable

I want to insert a row to Bigtable, I tried this simple code

const rowToInsert = {
  key: `${tenantId}:${customerId}`,
  data: personalInfo
};

await table.insert(rowToInsert);

but I got

Error while mutating the row '999:customerId' : Requested column family not found.

The column family exists, so how can I set the column family for this insertion? I saw this example in the documentation and it's not clear to me

Upvotes: 1

Views: 1342

Answers (1)

arielorvits
arielorvits

Reputation: 5535

The Cloud Bigtable Writing Data documentation shows how to perform various writes

data: {
  [COLUMN_FAMILY_ID]: {
    [COLUMN_QUALIFIER]: {
      // Setting the timestamp allows the client to perform retries. If
      // server-side time is used, retries may cause multiple cells to
      // be generated.
      timestamp: new Date(),
      value: greeting,
    },
  },
},

Upvotes: 2

Related Questions