用于okera数据访问服务的python客户端
pyokera的Python项目详细描述
用于RecordService实现的Python客户端。
依赖关系
必需:
- Python3.4+
- six,bit_array,thriftpy2==0.3.12,urllib3,certifi
pip3 install six bit_array thriftpy2==0.3.12 urllib3 certifi
可选:
- pandas用于转换为DataFrame对象
安装
pip3 install pyokera
验证:
>>>importokera.odas>>>okera.odas.version()'##OKERA_RELEASE_VERSION##'
使用量
fromokeraimportcontextctx=context()withctx.connect(host='localhost',port=12050)asconn:conn.list_databases()pd=conn.scan_as_pandas("okera_sample.sample")pd
要使用令牌身份验证启用到服务器的连接:
fromokeraimportcontextctx=context()ctx.enable_token_auth(token_str='my-token')withctx.connect(host='localhost',port=12050)asconn:conn.list_databases()
使用kerberos身份验证启用到服务器的连接:
fromokeraimportcontextctx=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()