用于访问托管平台的doorda sdk
doorda-sdk的Python项目详细描述
doorda python开发包
要求
- python 2.7/python 3
- DoordaHost Account
安装
Pypi
$ pip install doorda-sdk
来源
下载位置:
$ wget https://github.com/Doorda/doorda-python-sdk/archive/1.0.10.zip
$ unzip 1.0.10.zip
安装
$ python setup.py install
用法
门主机
连接到数据库
fromdoorda_sdk.hostimportclientconn=client.connect(username="username",password="password",catalog="catalog_name",schema="schema_name")cursor=conn.cursor()
执行查询
cursor.execute("SELECT * FROM table_name")# Returns generator of results# Does not put result into memory. Iterates through rows in a streaming fashion.forrowincursor.iter_result():# Do something with row# Fetch all resultsrows=cursor.fetchall()# Fetch one resultsrows=cursor.fetchone()# Fetch multiple resultsrows=cursor.fetchmany(size=10)# Get list of column namescursor.col_names# Get column names mapped to data typescursor.col_types
简化功能
# Check database connectionresults=cursor.is_connected()# List all catalogsrows=cursor.show_catalogs()# List all tablesrows=cursor.show_tables("catalog_name","schema_name")# Get number of rowsrows=cursor.table_stats(catalog="catalog_name",schema="schema_name",table="table_name")
了解更多信息
要了解doordahost的更多信息,请前往https://github.com/Doorda/Getting-Started