Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b9ec94a2
T
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1181
Star
22014
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
b9ec94a2
编写于
9月 25, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
9月 25, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3659 from taosdata/xiaoping/add_test_case
[TD-1587]<test> add python restful example
上级
89ab4c79
b694980d
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
161 addition
and
3 deletion
+161
-3
documentation20/webdocs/markdowndocs/TAOS SQL-ch.md
documentation20/webdocs/markdowndocs/TAOS SQL-ch.md
+2
-2
tests/pytest/client/alterDatabase.py
tests/pytest/client/alterDatabase.py
+55
-0
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+2
-0
tests/pytest/insert/alterTableAndInsert.py
tests/pytest/insert/alterTableAndInsert.py
+40
-0
tests/pytest/insert/restful.py
tests/pytest/insert/restful.py
+60
-0
tests/pytest/query/queryNormal.py
tests/pytest/query/queryNormal.py
+2
-1
未找到文件。
documentation20/webdocs/markdowndocs/TAOS SQL-ch.md
浏览文件 @
b9ec94a2
...
...
@@ -98,12 +98,12 @@ TDengine缺省的时间戳是毫秒精度,但通过修改配置参数enableMic
KEEP参数是指修改数据文件保存的天数,缺省值为3650,取值范围[days, 365000],必须大于或等于days参数值。
```mysql
ALTER DATABASE db_name QUORUM
365
;
ALTER DATABASE db_name QUORUM
2
;
```
QUORUM参数是指数据写入成功所需要的确认数。取值范围[1, 3]。对于异步复制,quorum设为1,具有master角色的虚拟节点自己确认即可。对于同步复制,需要至少大于等于2。原则上,Quorum >=1 并且 Quorum <= replica(副本数),这个参数在启动一个同步模块实例时需要提供。
```mysql
ALTER DATABASE db_name BLOCKS
365
;
ALTER DATABASE db_name BLOCKS
100
;
```
BLOCKS参数是每个VNODE (TSDB) 中有多少cache大小的内存块,因此一个VNODE的用的内存大小粗略为(cache * blocks)。取值范围[3, 1000]。
...
...
tests/pytest/client/alterDatabase.py
0 → 100644
浏览文件 @
b9ec94a2
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
run
(
self
):
tdSql
.
prepare
()
tdSql
.
query
(
'select database()'
)
tdSql
.
checkData
(
0
,
0
,
"db"
)
tdSql
.
execute
(
"alter database db comp 2"
)
tdSql
.
query
(
"show databases"
)
tdSql
.
checkData
(
0
,
14
,
2
)
tdSql
.
execute
(
"alter database db keep 365"
)
tdSql
.
query
(
"show databases"
)
tdSql
.
checkData
(
0
,
7
,
"3650,3650,365"
)
tdSql
.
execute
(
"alter database db quorum 2"
)
tdSql
.
query
(
"show databases"
)
tdSql
.
checkData
(
0
,
5
,
2
)
tdSql
.
execute
(
"alter database db blocks 100"
)
tdSql
.
query
(
"show databases"
)
tdSql
.
checkData
(
0
,
9
,
100
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
\ No newline at end of file
tests/pytest/fulltest.sh
浏览文件 @
b9ec94a2
...
...
@@ -17,6 +17,7 @@ python3 ./test.py -f insert/nchar-unicode.py
python3 ./test.py
-f
insert/multi.py
python3 ./test.py
-f
insert/randomNullCommit.py
python3 insert/retentionpolicy.py
python3 ./test.py
-f
insert/alterTableAndInsert.py
python3 ./test.py
-f
table/column_name.py
python3 ./test.py
-f
table/column_num.py
...
...
@@ -163,6 +164,7 @@ python3 ./test.py -f alter/alter_table_crash.py
# client
python3 ./test.py
-f
client/client.py
python3 ./test.py
-f
client/version.py
python3 ./test.py
-f
client/alterDatabase.py
# Misc
python3 testCompress.py
...
...
tests/pytest/insert/alterTableAndInsert.py
0 → 100644
浏览文件 @
b9ec94a2
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
run
(
self
):
tdSql
.
prepare
()
tdSql
.
execute
(
"create table cars(ts timestamp, speed int) tags(id int)"
)
tdSql
.
execute
(
"create table car0 using cars tags(0)"
)
tdSql
.
execute
(
"insert into car0 values(now, 1)"
)
tdSql
.
execute
(
"alter table cars add column c2 int"
)
tdSql
.
execute
(
"insert into car0(ts, 'speed') values(now, 2)"
)
tdSql
.
checkAffectedRows
(
1
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/insert/restful.py
0 → 100644
浏览文件 @
b9ec94a2
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
import
requests
,
json
import
threading
import
string
import
random
class
RestfulInsert
:
def
init
(
self
):
self
.
header
=
{
'Authorization'
:
'Basic cm9vdDp0YW9zZGF0YQ=='
}
self
.
url
=
"http://127.0.0.1:6041/rest/sql"
self
.
ts
=
1104508800000
self
.
numOfThreads
=
50
def
get_random_string
(
self
,
length
):
letters
=
string
.
ascii_lowercase
result_str
=
''
.
join
(
random
.
choice
(
letters
)
for
i
in
range
(
length
))
return
result_str
def
insertData
(
self
,
threadID
):
print
(
"thread %d started"
%
threadID
)
data
=
"create table test.tb%d(ts timestamp, name nchar(20))"
%
threadID
requests
.
post
(
self
.
url
,
data
,
headers
=
self
.
header
)
name
=
self
.
get_random_string
(
10
)
start
=
self
.
ts
while
True
:
start
+=
1
data
=
"insert into test.tb%d values(%d, '%s')"
%
(
threadID
,
start
,
name
)
requests
.
post
(
self
.
url
,
data
,
headers
=
self
.
header
)
def
run
(
self
):
data
=
"drop database if exists test"
requests
.
post
(
self
.
url
,
data
,
headers
=
self
.
header
)
data
=
"create database test keep 7300"
requests
.
post
(
self
.
url
,
data
,
headers
=
self
.
header
)
threads
=
[]
for
i
in
range
(
self
.
numOfThreads
):
thread
=
threading
.
Thread
(
target
=
self
.
insertData
,
args
=
(
i
,))
thread
.
start
()
threads
.
append
(
thread
)
for
i
in
range
(
self
.
numOfThreads
):
threads
[
i
].
join
()
ri
=
RestfulInsert
()
ri
.
init
()
ri
.
run
()
\ No newline at end of file
tests/pytest/query/queryNormal.py
浏览文件 @
b9ec94a2
...
...
@@ -35,7 +35,8 @@ class TDTestCase:
tdSql
.
execute
(
"insert into tb2 using stb1 tags(2,'tb2', '表2') values ('2020-04-18 15:00:02.000', 3, 2.1), ('2020-04-18 15:00:03.000', 4, 2.2)"
)
# inner join --- bug
tdSql
.
error
(
"select * from tb 1"
)
tdSql
.
query
(
"select * from tb1 a, tb2 b where a.ts = b.ts"
)
tdSql
.
checkRows
(
0
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录