Happybase的基本使用

简介:

Happybase是Python通过Thrift访问HBase的库,方便快捷。

基本使用

 
  1. import happybase
  2. connection = happybase.Connection('hostname')
  3. table = connection.table('table-name')
  4. table.put('row-key', {'family:qual1': 'value1', 'family:qual2': 'value2'})
  5. row = table.row('row-key')
  6. print row['family:qual1'] # prints 'value1'
  7. for key, data in table.rows(['row-key-1', 'row-key-2']):
  8. print key, data # prints row key and data for each row
  9. for key, data in table.scan(row_prefix='row'):
  10. print key, data # prints 'value1' and 'value2'
  11. row = table.delete('row-key')

链接

 
  1. # lazy connection
  2. connection = happybase.Connection('somehost', autoconnect=False)
  3. # and before first use:
  4. connection.open()
  5. # show all tables
  6. print connection.tables()
  7. # Using table namespace
  8. connection = happybase.Connection('somehost', table_prefix='myproject')

 
  1. connection.create_table(
  2. 'mytable',
  3. {'cf1': dict(max_versions=10),
  4. 'cf2': dict(max_versions=1, block_cache_enabled=False),
  5. 'cf3': dict(), # use defaults
  6. }
  7. )
  8. table = connection.table('mytable')
目录
相关文章
|
2月前
最新jsonwebtoken-jjwt 0.12.3 基本使用
最新jsonwebtoken-jjwt 0.12.3 基本使用
204 0
|
2月前
|
人工智能 自然语言处理 算法
DashText进阶使用方法
基于关键词感知的向量检索,稠密向量和稀疏向量组合搜索DashText,进阶使用详细教程来啦~
|
2月前
|
API
Vue3进阶5个小知识点 附带源码
Vue3进阶5个小知识点 附带源码
37 0
|
20天前
|
XML Java 数据格式
Acitiviti7基本使用- 2、Servcie服务接口介绍
Acitiviti7基本使用- 2、Servcie服务接口介绍
11 0
|
2月前
|
JavaScript 前端开发 中间件
Redux学习笔记---简单使用以及源码阅读
Redux学习笔记---简单使用以及源码阅读
|
2月前
|
存储 NoSQL 定位技术
RedisGEO的基本使用
对GEO的基本介绍
|
2月前
|
存储 缓存 Java
【scoop】安装及基本使用
【scoop】安装及基本使用
314 0
|
JavaScript 算法 前端开发
【Vue 快速入门系列】列表的基本使用
【Vue 快速入门系列】列表的基本使用
148 0
【Vue 快速入门系列】列表的基本使用
CodeBlock 基本使用
基本介绍 代码块又称为初始化块,属于类中的成员【即是类的一部分,类似于方法,讲逻辑语句封装在方法体中,通过{}包围起来】 和方法不同,没有方法名,没有返回值,没有参数,只有方法体,而且不用通过对象或类显式调用,而是加载类时或创建对象时隐式调用。
108 0
|
Go
基本使用
基本使用
70 0