-
Notifications
You must be signed in to change notification settings - Fork 602
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
Binary data in BigTable column #1526
Comments
Hi @arbesfeld, we don't stringify any data before trying to insert it. However, we do transform any data you pass in into Buffers. Have you tried passing your data in as a string/number? e.g. this.table.insert([
{
key: 'foo',
data: {
familyName: {
columnName: 'data'
}
}
}
]); |
@arbesfeld can you give me an example of what kind of data you're trying to save? (Aside from Node buffers) |
@arbesfeld we've just merged some changes for the Bigtable API. Assuming what you're passing in is a Buffer, then it should pass through just fine to the API. When retrieving the data, if you want a Buffer returned to you, you'll need to set the table.getRows({ decode: false }, function(err, rows) {}); |
Hey @callmehiphop, I'm setting |
@callmehiphop I think we should always create the Buffer from the response base64 value: https://github.com/GoogleCloudPlatform/google-cloud-node/blob/3cbc93b9d770dd25aa5c6ed1f215e01518e42a03/packages/bigtable/src/row.js#L163 if (qualifier && chunk.value) {
var value = Mutation.convertFromBytes(chunk.value, options);
qualifier.push({
value: value,
labels: chunk.labels,
timestamp: chunk.timestampMicros,
size: chunk.valueSize
});
} and do something like this in Mutation.convertFromBytes: var buf = new Buffer(bytes, 'base64');
var num = new Int64(buf).toNumber();
if (!isNaN(num) && isFinite(num)) {
return num;
}
if (options && options.decode === false) {
return buf;
}
return buf.toString(); |
Hi, I am trying to store an encode protobuf in BigTable and I'm not able to insert binary data (represented as a Buffer) into a BigTable column. I have tried the following ways:
It seems to get stringified somewhere in the client library, which is making the data invalid.
The text was updated successfully, but these errors were encountered: