We have a requirement wherein a composite key has to be fed as the primary key via python client.
Eg :
PrimaryKey={"a1": "val1", "b1": val2}
key = ('namespace', 'setname', primaryKey)
client.put(key,bins)
Error :
(-2L, ‘key is invalid’, ‘src/main/conversions.c’, 952, False)
I understand that key should be either String/int/byteArr.
What is the effective way to convert the above primaryKey to ByteArray? Please note the records must be editable on GUI , which uses java client to fetch records?
Why not just concatenate it into 1 string like a1val1b1val2 as the PK string?
You know the PK isn’t stored, right (at least by default…)? Seems odd to use a dict as a key so just throwing that out there…
Seems odd to use a dict as a key so just throwing that out there
We had to design in this way to meet our requirements and cannot redesign this approach now as there are a lot of dependencies involved.
Can’t you just convert that dict to bytes?
Tried it, The records that are persisted via python client couldn’t be queried from java client, The way python generates byte array is different from what we have implemented in java code.
The problem here is, During the implementation in java, we are serializing the map and converting both key value pair using ByteArrayOutputStream and getting byteArray. Which is then passed as primary key in key tuple.
Maybe you mean to store that as bins?
No, Not as separate bins.
I understand that having dict as the primary key is not advised. Is there any way to solve my problem?