用于okera数据访问服务的python客户端
pokera的Python项目详细描述
用于RecordService实现的Python客户端。
依赖关系
必需:
- Python3.4+
- six,bit_array,thriftpy >=0.3.9
pip3 install six bit_array 'thriftpy>=0.3.9'
可选:
- pandas用于转换为DataFrame对象
安装
pip3 install pycerebro
验证:
>>>importcerebro.cdas>>>cerebro.cdas.version()'0.8.0-beta3'
使用量
fromcerebroimportcontextctx=context()withctx.connect(host='localhost',port=12050)asconn:conn.list_databases()pd=conn.scan_as_pandas("cerebro_sample.sample")pd
要使用令牌身份验证启用到服务器的连接:
fromcerebroimportcontextctx=context()ctx.enable_token_auth(token_str='my-token')withctx.connect(host='localhost',port=12050)asconn:conn.list_databases()
使用kerberos身份验证启用到服务器的连接:
fromcerebroimportcontextctx=context()# Connecting to server principal 'cerebro/service@REALM'ctx.enable_kerberos('cerebro',host_override='service')withctx.connect(host='localhost',port=12050)asconn:conn.list_databases()