获取cassandra中的所有行 [英] Fetch all rows in cassandra

查看:26
本文介绍了获取cassandra中的所有行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含 300 万行的 cassandra 表.现在我试图获取所有行并将它们写入几个 csv 文件.我知道不可能执行 select * from mytable.有人可以告诉我怎么做吗?

I have a cassandra table containing 3 million rows. Now I am trying to fetch all the rows and write them to several csv files. I know it is impossible to perform select * from mytable. Could someone please tell how I can do this?

或者有什么方法可以在不指定任何where条件的情况下通过n行读取n行?

Or are there any ways to read the rows n rows by n rows without specifying any where conditions?

推荐答案

据我所知,cassandra 2.0 的一项改进'在驱动程序方面' 是自动分页.你可以这样做:

as I know, one improvement in cassandra 2.0 'on the driver side' is automatic-paging. you can do something like this :

Statement stmt = new SimpleStatement("SELECT * FROM images LIMIT 3000000");
stmt.setFetchSize(100);
ResultSet rs = session.execute(stmt);

// Iterate over the ResultSet here

欲了解更多信息,请阅读 Cassandra 2.0 驱动程序方面的改进

for more read Improvements on the driver side with Cassandra 2.0

您可以在此处找到驱动程序.

you can find the driver here.

这篇关于获取cassandra中的所有行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆