gpt4 book ai didi

database - 如何使用 aerospike 加载程序在 aerospike 中加载嵌套的 csv 文件?

转载 作者:太空狗 更新时间:2023-10-30 01:56:26 24 4
gpt4 key购买 nike

我已将 JSON 文件转换为 CSV 格式,现在使用 aerospike 加载器将 CSV 加载到 Aerospike 中。我可以为简单的结构执行此操作,但如何修改 allDatatype.json 的内容以在 Aerospike 中加载嵌套的 CSV 文件?

https://github.com/aerospike/aerospike-loader/tree/master/example

JSON 文件

{
"centers" : {
"ER" : {
"admin":{
"users" : {
"emp1" : {
"password" : "abcdefgh",
"username" : "pankaj-roy"
},
"emp2" : {
"password" : "12345678",
"username" : "niketan-shah"
}
}
}
}
}
}

CSV 文件

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

最佳答案

我必须承认我的理解是有限的,因为我才刚刚开始研究 Aerospike 是忘记了你想将整个对象存储在一个中(正如上面评论中所建议的,因为这更像是一个文档存储).相反,您需要在 Key-Value 术语的世界中考虑它。我的理解是你上面的 json payload 应该像这样存储在 Aerospike 中

Bin=users
Set=creds
Key=(username, "pankaj-roy")
bin=(password, "abcdefgh")
bin=(role, "admin")`

然后你可以这样做:

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");

关于database - 如何使用 aerospike 加载程序在 aerospike 中加载嵌套的 csv 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32794867/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com