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')
目录
相关文章
|
11天前
最新jsonwebtoken-jjwt 0.12.3 基本使用
最新jsonwebtoken-jjwt 0.12.3 基本使用
46 0
|
4月前
|
存储 缓存 Java
【scoop】安装及基本使用
【scoop】安装及基本使用
195 0
|
5月前
|
存储 NoSQL 定位技术
RedisGEO的基本使用
对GEO的基本介绍
|
12月前
QWebEngineView简单使用
QWebEngineView是提供一个访问web页面的widget,这里是一个简单的使用代码
133 0
CodeBlock 基本使用
基本介绍 代码块又称为初始化块,属于类中的成员【即是类的一部分,类似于方法,讲逻辑语句封装在方法体中,通过{}包围起来】 和方法不同,没有方法名,没有返回值,没有参数,只有方法体,而且不用通过对象或类显式调用,而是加载类时或创建对象时隐式调用。
98 0
|
Go
基本使用
基本使用
62 0
|
JavaScript 算法 前端开发
【Vue 快速入门系列】列表的基本使用
【Vue 快速入门系列】列表的基本使用
141 0
【Vue 快速入门系列】列表的基本使用
|
存储 开发者 Python
列表的基本使用|学习笔记
快速学习列表的基本使用
59 0
|
机器人 测试技术 Android开发
【第二篇】XiaoZaiMultiAutoAiDevices之基本使用
从一个框架,延伸各项知识点,补补基础,挺好~
117 0