Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
bfcee759
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
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看板
未验证
提交
bfcee759
编写于
10月 26, 2021
作者:
L
Linhe Huo
提交者:
GitHub
10月 26, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-10771]<fix>: fix invalid syntax error for python2 (#8430)
上级
94318159
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
37 addition
and
20 deletion
+37
-20
src/connector/python/tests/test_lines.py
src/connector/python/tests/test_lines.py
+0
-3
tests/examples/python/taosdemo/taosdemo.py
tests/examples/python/taosdemo/taosdemo.py
+37
-17
未找到文件。
src/connector/python/tests/test_lines.py
浏览文件 @
bfcee759
...
...
@@ -28,15 +28,12 @@ def test_schemaless_insert(conn):
'stf,t1=4i64,t3="t4",t2=5f64,t4=5f64 c1=3i64,c3=L"passitagin_stf",c2=false,c5=5f64,c6=7u64 1626006933641000000'
,
]
conn
.
schemaless_insert
(
lines
,
0
,
"ns"
)
print
(
"inserted"
)
lines
=
[
'stf,t1=5i64,t3="t4",t2=5f64,t4=5f64 c1=3i64,c3=L"passitagin_stf",c2=false,c5=5f64,c6=7u64 1626006933641000000'
,
]
conn
.
schemaless_insert
(
lines
,
0
,
"ns"
)
print
(
"inserted"
)
result
=
conn
.
query
(
"select * from st"
)
print
(
*
result
.
fields
)
all
=
result
.
rows_iter
()
for
row
in
all
:
print
(
row
)
...
...
tests/examples/python/taosdemo/taosdemo.py
浏览文件 @
bfcee759
...
...
@@ -21,78 +21,91 @@ import json
import
random
import
time
import
datetime
import
multiprocessing
from
multiprocessing
import
Manager
,
Pool
,
Lock
from
multipledispatch
import
dispatch
from
concurrent.futures
import
ThreadPoolExecutor
,
wait
,
ALL_COMPLETED
@
dispatch
(
str
,
str
)
def
v_print
(
msg
:
str
,
arg
:
str
):
def
v_print
(
msg
,
arg
):
# type: (str, str) -> None
if
verbose
:
print
(
msg
%
arg
)
@
dispatch
(
str
,
str
,
str
)
def
v_print
(
msg
:
str
,
arg1
:
str
,
arg2
:
str
):
def
v_print
(
msg
,
arg1
,
arg2
):
# type: (str, str, str) -> None
if
verbose
:
print
(
msg
%
(
arg1
,
arg2
))
@
dispatch
(
str
,
str
,
str
,
str
)
def
v_print
(
msg
:
str
,
arg1
:
str
,
arg2
:
str
,
arg3
:
str
):
def
v_print
(
msg
,
arg1
,
arg2
,
arg3
):
# type: (str, str, str, str) -> None
if
verbose
:
print
(
msg
%
(
arg1
,
arg2
,
arg3
))
@
dispatch
(
str
,
str
,
str
,
str
,
str
)
def
v_print
(
msg
:
str
,
arg1
:
str
,
arg2
:
str
,
arg3
:
str
,
arg4
:
str
):
def
v_print
(
msg
,
arg1
,
arg2
,
arg3
,
arg4
):
# type: (str, str, str, str, str) -> None
if
verbose
:
print
(
msg
%
(
arg1
,
arg2
,
arg3
,
arg4
))
@
dispatch
(
str
,
int
)
def
v_print
(
msg
:
str
,
arg
:
int
):
def
v_print
(
msg
,
arg
):
# type: (str, int) -> None
if
verbose
:
print
(
msg
%
int
(
arg
))
@
dispatch
(
str
,
int
,
str
)
def
v_print
(
msg
:
str
,
arg1
:
int
,
arg2
:
str
):
def
v_print
(
msg
,
arg1
,
arg2
):
# type: (str, int, str) -> None
if
verbose
:
print
(
msg
%
(
int
(
arg1
),
str
(
arg2
)))
@
dispatch
(
str
,
str
,
int
)
def
v_print
(
msg
:
str
,
arg1
:
str
,
arg2
:
int
):
def
v_print
(
msg
,
arg1
,
arg2
):
# type: (str, str, int) -> None
if
verbose
:
print
(
msg
%
(
arg1
,
int
(
arg2
)))
@
dispatch
(
str
,
int
,
int
)
def
v_print
(
msg
:
str
,
arg1
:
int
,
arg2
:
int
):
def
v_print
(
msg
,
arg1
,
arg2
):
# type: (str, int, int) -> None
if
verbose
:
print
(
msg
%
(
int
(
arg1
),
int
(
arg2
)))
@
dispatch
(
str
,
int
,
int
,
str
)
def
v_print
(
msg
:
str
,
arg1
:
int
,
arg2
:
int
,
arg3
:
str
):
def
v_print
(
msg
,
arg1
,
arg2
,
arg3
):
# type: (str, int, int, str) -> None
if
verbose
:
print
(
msg
%
(
int
(
arg1
),
int
(
arg2
),
str
(
arg3
)))
@
dispatch
(
str
,
int
,
int
,
int
)
def
v_print
(
msg
:
str
,
arg1
:
int
,
arg2
:
int
,
arg3
:
int
):
def
v_print
(
msg
,
arg1
,
arg2
,
arg3
):
# type: (str, int, int, int) -> None
if
verbose
:
print
(
msg
%
(
int
(
arg1
),
int
(
arg2
),
int
(
arg3
)))
@
dispatch
(
str
,
int
,
int
,
int
,
int
)
def
v_print
(
msg
:
str
,
arg1
:
int
,
arg2
:
int
,
arg3
:
int
,
arg4
:
int
):
def
v_print
(
msg
,
arg1
,
arg2
,
arg3
,
arg4
):
# type: (str, int, int, int, int) -> None
if
verbose
:
print
(
msg
%
(
int
(
arg1
),
int
(
arg2
),
int
(
arg3
),
int
(
arg4
)))
def
restful_execute
(
host
:
str
,
port
:
int
,
user
:
str
,
password
:
str
,
cmd
:
str
):
def
restful_execute
(
host
,
port
,
user
,
password
,
cmd
):
# type: (str, int, str, str, str) -> None
url
=
"http://%s:%d/rest/sql"
%
(
host
,
restPort
)
v_print
(
"restful_execute - cmd: %s"
,
cmd
)
...
...
@@ -112,7 +125,8 @@ def restful_execute(host: str, port: int, user: str, password: str, cmd: str):
print
(
"resp: %s"
%
json
.
dumps
(
resp
.
json
()))
def
query_func
(
process
:
int
,
thread
:
int
,
cmd
:
str
):
def
query_func
(
process
,
thread
,
cmd
):
# type: (int, int, str) -> None
v_print
(
"%d process %d thread cmd: %s"
,
process
,
thread
,
cmd
)
if
oneMoreHost
!=
"NotSupported"
and
random
.
randint
(
...
...
@@ -133,7 +147,8 @@ def query_func(process: int, thread: int, cmd: str):
host
,
port
,
user
,
password
,
cmd
)
def
query_data_process
(
cmd
:
str
):
def
query_data_process
(
cmd
):
# type: (str) -> None
# establish connection if native
if
native
:
v_print
(
"host:%s, user:%s passwd:%s configDir:%s "
,
host
,
user
,
password
,
configDir
)
...
...
@@ -256,7 +271,8 @@ def drop_databases():
(
dbName
,
i
))
def
insert_func
(
process
:
int
,
thread
:
int
):
def
insert_func
(
process
,
thread
):
# type: (int, int) -> None
v_print
(
"%d process %d thread, insert_func "
,
process
,
thread
)
# generate uuid
...
...
@@ -374,7 +390,8 @@ def create_tb():
(
tbName
,
j
))
def
insert_data_process
(
lock
,
i
:
int
,
begin
:
int
,
end
:
int
):
def
insert_data_process
(
lock
,
i
,
begin
,
end
):
# type: (multiprocessing._LockType, int, int, int) -> None
lock
.
acquire
()
tasks
=
end
-
begin
v_print
(
"insert_data_process:%d table from %d to %d, tasks %d"
,
i
,
begin
,
end
,
tasks
)
...
...
@@ -675,7 +692,10 @@ if __name__ == "__main__":
printConfig
()
if
not
skipPrompt
:
input
(
"Press any key to continue.."
)
try
:
input
(
"Press any key to continue.."
)
except
SyntaxError
:
pass
# establish connection first if native
if
native
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录