github:
下载源码:
git clone .git
git checkout ver-2.0.1.0
cmake .
make
make install
#cp packaging/deb/taosd /etc/init.d/
#chmod +x /etc/init.d/taosd
#mkdir -p /etc/taos
#cp test/cfg/taos.cfg /etc/taos/
cd ..
启动:
taosd -c /etc/taos/taos.cfg
连接:
taos
create database db;
use db;
create table t (ts timestamp, a int);
insert into t values ('2019-07-15 00:00:00', 1);
insert into t values ('2019-07-15 01:00:00', 2);
select * from t;
#drop database db;
https://www.taosdata.com/cn/documentation/connector/#Python-Connector
安装python模板
/usr/local/anaconda2/bin/pip install src/connector/python/linux/python2/
improt taos
conn = taos.connect(host="127.0.0.1", user="root", password="taosdata", config="/etc/taos")
c1 = conn.cursor()
c1.execute('select * from db.t')
c1.fetchall()
c1.close()
conn.close()
echo root:taosdata|base64 加密
echo SGVsbG8gV29ybGQK | base64 -d 解密
curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'select * from db.t'
import requests
import json
url = ''
# curl -H 'Authorization: Basic
' -d '' :/rest/sql
# TOKEN为{username}:{password}经过Base64编码之后的字符串,例如root:taosdata编码后为cm9vdDp0YW9zZGF0YQ==
headers = {'Authorization': 'Basic cm9vdDp0YW9zZGF0YQ=='}
# body = 'select * from db1.tb1' # HTTP请求的BODY里有SQL语句
body = "insert into db1.tb1 values('2010-07-23 11:01:03.000', 39, 55.1)"
r = requests.post(url, headers=headers,data=body)
t=r.content # 读取返回的内容
t = json.loads(t) # 解码JSON对象
print(t)
阅读(1687) | 评论(0) | 转发(0) |