提取cassandra中的所有行 [英] Fetch all rows in cassandra
本文介绍了提取cassandra中的所有行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个包含300万行的cassandra表。现在,我试图获取所有行并将它们写入几个csv文件。我知道不可能从mytable中执行 select *
。有人可以告诉我我该怎么做吗?
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?
或者有什么方法可以读取行 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在驱动程序方面进行的改进
您可以在此处找到驱动程序。
you can find the driver here.
这篇关于提取cassandra中的所有行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文