简单的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 Intellij通过方法中的包查找用法   java中VS代码和打包命名的问题   将java CMS功能集成到具有高度动态内容的网站(Lucene/Mysql/Nosql)的策略   oracle的java类强制转换异常。jdbc。驾驶员OracleConnection   字节码向JVM添加上指令   如何在抽象类中执行java方法?   java是否可以在apache访问日志中排除指定的GET参数?(作者:W7开发环境)   java如何获取已安装音频播放器的列表?   尝试向HS学生展示如何使用Java访问MS数据库   使用正则表达式java对给定行中的特定字符串进行计数   java JOOQ Select查询中的Select计数   方法Java,如何从二维双精度数组中找到特定值?   获取图像URL的java正则表达式   java在切换到新的窗口驱动程序后找不到元素