python 使用pycassa 链接cassandra 获取数据

KEYSPACE1' = pycassa.ConnectionPool('KEYSPACE1') COLUMNFAMILY1 = pycassa.ColumnFamily(KEYSPACE1', 'COLUMNFAMILY1') #va=COLUMNFAMILY1.get('test1')  默认只取前100行 va=COLUMNFAMILY1.get('test1',column_count=300)


http://pycassa.github.io/pycassa/api/pycassa/columnfamily.html#pycassa.columnfamily.ColumnFamily.get


get(key[, columns][, column_start][, column_finish][, column_reversed][, column_count][, include_timestamp][, super_column][, read_consistency_level]) 
Fetches all or part of the row with key key. 
The columns fetched may be limited to a specified list of column names using columns.
 Alternatively, you may fetch a slice of columns or super columns from a row using column_start, column_finish, and column_count. Setting these will cause columns or super columns to be fetched starting with column_start, continuing until column_count columns or super columns have been fetched or column_finish is reached. If column_start is left as the empty string, the slice will begin with the start of the row; leaving column_finishblank will cause the slice to extend to the end of the row. Note that column_count defaults to 100, so rows over this size will not be completely fetched by default.
 If column_reversed is True, columns are fetched in reverse sorted order, beginning with column_start. In this case, if column_start is the empty string, the slice will begin with the end of the row. 
You may fetch all or part of only a single super column by setting super_column. If this is set, column_start, column_finish, column_count, andcolumn_reversed will apply to the subcolumns of super_column.
 To include every column’s timestamp in the result set, set include_timestamp to True. Results will include a (value, timestamp) tuple for each column. 
If this is a standard column family, the return type is of the form {column_name: column_value}. If this is a super column family and super_column is not specified, the results are of the form {super_column_name: {column_name, column_value}}. If super_column is set, the super column name will be excluded and the results are of the form {column_name: column_value}.

转载于:https://my.oschina.net/opperlili/blog/133094

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值