简单的JSON给Cassandra Python客户。

CassandraJsonMapper的Python项目详细描述


#cassandrajsonmapper


cassandrajsonmapper是一个apache cassandra python驱动程序,用于直接存储映射到cassandra复合列的json样式的对象。

重量轻,读写速度快,适合短脉冲数据。我正在处理rest api调用返回的json,稍后我将对其进行轻量级分析。这很适合我的用例,
所以我决定共享它。


cassandrajsonmapper将使用的列族的模式必须与提供的类似。

**注意:**
请记住,创建的复合列数必须至少与要保存的最深的json文档的深度相同。

``sql
create keyspace json
with placement撸strategy='simplestrategy'
,strategy撸options={replication撸factor:1};

使用json;

org.apache.cassandra.db.marshall.bytestype,
org.apache.cassandra.db.marshall.bytestype,org.apache.cassandra.db.marshall.bytestype,
org.apache.cassandra.db.marshall.bytestype,org.apache.cassandra.db.marshall.bytestype,
org.apache.cassandra.db.marshall.bytestype,org.apache.cassandra.db.marshall.bytestype,
org.apache.cassandra.db.marshall.bytestype,org.apache.cassandra.db.marshall.bytestype,
org.apache.cassandra.db.marshall.bytestype,org.apache.cassandra.db.marshall.bytestype,
org.apache.cassandra.db.marshall.bytestype,org.apache.cassandra.db.marshall.bytestype,
org.apache.cassandra.db.marshall.bytestype,org.apache.cassandra.db.marshall.bytestype,
org.apache.cassandra.db.marshall.bytestype,org.apache.cassandra.db.marshall.bytestype)
,默认的验证类为“bytestype”
,键验证类为“bytestype”;
```



列“json”

'key2':{
'test':'好的'
}
}
db.save(document)
assert db.get('key2')==document['key2']

db.delete('key2')
assert db.get('key2')={}
```


示例

``python
db.mt_save(document)
db.mt_finish()


assert db.get('key2')==document['key2']
`````


不支持以下操作:

*不能附加到列表。
*不能删除文档的部分。
*可能无法完整返回读取结果,但是支持分页。




写入一致性=一致性级别。一,
读取一致性=一致性级别。一,
请求大小=100,批处理大小=6000,线程计数=20)
“创建cassandra连接池和cf连接。”


def save(self,dictionary有效负载,write一致性=none,批处理大小=无)
“将字典转换并保存到cassandra。”

def get(self,key,read_consistency=none,
return_lastow=false,column_start=none,request_size=none)
“读取cassandra响应并将其转换为字典。”

“从cassandra中删除字典。”

“异步保存字典。”


def mt_finish(self)
“等待执行所有挂起的插入。”
```

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java为新对象()保留了多少内存空间;   keytool错误:java。木卫一。IOException:安卓密钥库被篡改或密码不正确   java Recyclerview不可点击安卓 studio(可能是我的代码错误?)   爪哇警报每天早上5点   安卓为java循环中的json对象添加值   java NetBeans“与编辑器链接”功能   SQL Server与Java EE演练   如何在Java应用程序中嵌入迷你控制台?   java Pig UDF,在批处理过程中删除分布式缓存中的文件   javascript使用GWT关闭网络摄像头和灯光   将Eclipse开普勒SR1升级到SR2时发生java错误?   java使用HashMap计算数组中某些整数的数量   java如何保护Android代码不受反向工程的影响?   java为什么添加这个防御副本可以避免死锁?   java我无法上传文件,需要哪些jar文件?   在java中,同一个程序可以作为服务器运行,也可以作为其他程序的客户端运行?   java从内部记录访问非静态外部上下文   java如何在使用Hibernate时打印带有参数值的查询字符串   Java向量类未更新