Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
29b8eb76
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
29b8eb76
编写于
7月 19, 2022
作者:
J
jiacy-jcy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
c27d1bd4
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
45 addition
and
14 deletion
+45
-14
tests/system-test/1-insert/delete_data.py
tests/system-test/1-insert/delete_data.py
+45
-14
未找到文件。
tests/system-test/1-insert/delete_data.py
浏览文件 @
29b8eb76
...
...
@@ -28,6 +28,7 @@ class TDTestCase:
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
self
.
dbname
=
'db_test'
self
.
setsql
=
TDSetSql
()
self
.
stbname
=
'stb'
self
.
ntbname
=
'ntb'
self
.
rowNum
=
10
self
.
tbnum
=
20
...
...
@@ -51,6 +52,7 @@ class TDTestCase:
'col13'
:
f
'nchar(
{
self
.
str_length
}
)'
,
}
self
.
tinyint_val
=
random
.
randint
(
constant
.
TINYINT_MIN
,
constant
.
TINYINT_MAX
)
self
.
smallint_val
=
random
.
randint
(
constant
.
SMALLINT_MIN
,
constant
.
SMALLINT_MAX
)
self
.
int_val
=
random
.
randint
(
constant
.
INT_MIN
,
constant
.
INT_MAX
)
...
...
@@ -146,10 +148,36 @@ class TDTestCase:
else
:
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
0
][
0
],
base_data
[
column_type
])
def
delete_rows
(
self
):
def
delete_rows
(
self
,
dbname
,
tbname
,
col_name
,
col_type
,
base_data
,
rowNum
):
for
i
in
range
(
rowNum
):
tdSql
.
execute
(
f
'delete from
{
tbname
}
where ts>
{
self
.
ts
+
i
}
'
)
tdSql
.
execute
(
f
'flush database
{
dbname
}
'
)
tdSql
.
execute
(
'reset query cache'
)
tdSql
.
query
(
f
'select
{
col_name
}
from
{
tbname
}
'
)
tdSql
.
checkRows
(
i
+
1
)
self
.
insert_base_data
(
col_type
,
tbname
,
rowNum
,
base_data
)
for
i
in
range
(
rowNum
):
tdSql
.
execute
(
f
'delete from
{
tbname
}
where ts>=
{
self
.
ts
+
i
}
'
)
tdSql
.
execute
(
f
'flush database
{
dbname
}
'
)
tdSql
.
execute
(
'reset query cache'
)
tdSql
.
query
(
f
'select
{
col_name
}
from
{
tbname
}
'
)
tdSql
.
checkRows
(
i
)
self
.
insert_base_data
(
col_type
,
tbname
,
rowNum
,
base_data
)
for
i
in
range
(
rowNum
):
tdSql
.
execute
(
f
'delete from
{
tbname
}
where ts<=
{
self
.
ts
+
i
}
'
)
tdSql
.
execute
(
f
'flush database
{
dbname
}
'
)
tdSql
.
execute
(
'reset query cache'
)
tdSql
.
query
(
f
'select
{
col_name
}
from
{
tbname
}
'
)
tdSql
.
checkRows
(
rowNum
-
i
-
1
)
self
.
insert_base_data
(
col_type
,
tbname
,
rowNum
,
base_data
)
for
i
in
range
(
rowNum
):
tdSql
.
execute
(
f
'delete from
{
tbname
}
where ts<
{
self
.
ts
+
i
}
'
)
tdSql
.
execute
(
f
'flush database
{
dbname
}
'
)
tdSql
.
execute
(
'reset query cache'
)
tdSql
.
query
(
f
'select
{
col_name
}
from
{
tbname
}
'
)
tdSql
.
checkRows
(
rowNum
-
i
)
self
.
insert_base_data
(
col_type
,
tbname
,
rowNum
,
base_data
)
pass
def
delete_error
(
self
,
tbname
,
column_name
,
column_type
,
base_data
):
for
error_list
in
[
''
,
f
'ts =
{
self
.
ts
}
and'
,
f
'ts =
{
self
.
ts
}
or'
]:
if
'binary'
in
column_type
.
lower
():
...
...
@@ -168,19 +196,22 @@ class TDTestCase:
self
.
delete_one_row
(
self
.
ntbname
,
col_type
,
col_name
,
self
.
base_data
,
self
.
dbname
)
self
.
delete_all_data
(
self
.
ntbname
,
col_type
,
self
.
rowNum
,
self
.
base_data
,
self
.
dbname
)
self
.
delete_error
(
self
.
ntbname
,
col_name
,
col_type
,
self
.
base_data
)
for
i
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
f
'delete from
{
self
.
ntbname
}
where ts>
{
self
.
ts
+
i
}
'
)
tdSql
.
execute
(
f
'flush database
{
self
.
dbname
}
'
)
tdSql
.
execute
(
'reset query cache'
)
tdSql
.
query
(
f
'select
{
col_name
}
from
{
self
.
ntbname
}
'
)
tdSql
.
checkRows
(
i
+
1
)
self
.
insert_base_data
(
col_type
,
self
.
ntbname
,
self
.
rowNum
,
self
.
base_data
)
self
.
delete_rows
(
self
.
dbname
,
self
.
ntbname
,
col_name
,
col_type
,
self
.
base_data
,
self
.
rowNum
)
tdSql
.
execute
(
f
'drop table
{
self
.
ntbname
}
'
)
tdSql
.
execute
(
f
'drop database
{
self
.
dbname
}
'
)
def
delete_data_ctb
(
self
):
tdSql
.
execute
(
f
'create database if not exists
{
self
.
dbname
}
'
)
tdSql
.
execute
(
f
'use
{
self
.
dbname
}
'
)
for
col_name
,
col_type
in
self
.
column_dict
.
items
():
tdSql
.
execute
(
f
'create table
{
self
.
stbname
}
(ts timestamp,
{
col_name
}
{
col_type
}
) tags(t1 int)'
)
for
i
in
range
(
self
.
tbnum
):
tdSql
.
execute
(
f
'create table
{
self
.
stbname
}
_
{
i
}
using
{
self
.
stbname
}
tags(1)'
)
self
.
insert_base_data
(
col_type
,
f
'
{
self
.
stbname
}
_
{
i
}
'
,
self
.
rowNum
,
self
.
base_data
)
self
.
delete_one_row
(
f
'
{
self
.
stbname
}
_
{
i
}
'
,
col_type
,
col_name
,
self
.
base_data
,
self
.
dbname
)
def
run
(
self
):
self
.
delete_data_ntb
()
#
self.delete_data_ntb()
self
.
delete_data_ctb
()
def
stop
(
self
):
tdSql
.
close
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录