I have converted JSON file to CSV format and now loading the CSV in Aerospike using aerospike loader. I can do this for simple structure but how to modify the contents of allDatatype.json to load the nested CSV file in Aerospike?
https://github.com/aerospike/aerospike-loader/tree/master/example
JSON FILE
{
"centers" : {
"ER" : {
"admin":{
"users" : {
"emp1" : {
"password" : "abcdefgh",
"username" : "pankaj-roy"
},
"emp2" : {
"password" : "12345678",
"username" : "niketan-shah"
}
}
}
}
}
}
CSV FILE
centers.ER.admin.users.emp2.username,centers.ER.admin.users.emp2.password, centers.ER.admin.users.emp1.username,centers.ER.admin.users.emp1.password
niketan-shah,12345678,pankaj-roy,abcdefgh
My understanding which I must admit is limited as I have only just started looking into Aerospike is to forget that you want to store the whole object in one (which as suggested above in the comments, as this is more like a document store). Instead you need to think of it in the world of Key-Value terms. My understanding is that your json payload above should be stored in Aerospike like so
Bin=users
Set=creds
Key=(username, "pankaj-roy")
bin=(password, "abcdefgh")
bin=(role, "admin")`
then you can do something like this:
user_key = new Key("users", "creds", username);
user_records = client.get(null, user_key);
console.printf("username: " + user_records.getValue("username") + "\n");
console.printf("password: " + user_records.getValue("password") + "\n");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With