提交 e84be94b 编写于 作者: G Ganlin Zhao

fixed python connector and test cases;

上级 ddb33879
......@@ -816,19 +816,22 @@ except AttributeError:
def taos_schemaless_insert(connection, lines, protocol, precision, msg_size=512):
def taos_schemaless_insert(connection, lines, protocol, precision):
# type: (c_void_p, list[str] | tuple(str)) -> None
num_of_lines = len(lines)
lines = (c_char_p(line.encode("utf-8")) for line in lines)
lines_type = ctypes.c_char_p * num_of_lines
p_lines = lines_type(*lines)
if precision is not None:
precision = c_char_p(precision.encode("utf-8"))
a_lines = c_int()
msg = create_string_buffer(msg_size)
errno = _libtaos.taos_schemaless_insert(connection, p_lines, num_of_lines, protocol, precision, byref(a_lines), msg, msg_size)
res = c_void_p(_libtaos.taos_schemaless_insert(connection, p_lines, num_of_lines, protocol, precision))
errno = taos_errno(res)
if errno != 0:
raise SchemalessError("schemaless insert error({}), affected_rows({})".format(msg.value.decode("utf-8"), a_lines.value), errno)
errstr = taos_errstr(res)
taos_free_result(res)
print("schemaless_insert error affected rows: {}".format(taos_affected_rows(res)))
raise SchemalessError(errstr, errno)
taos_free_result(res)
return errno
class CTaosInterface(object):
def __init__(self, config=None):
......
......@@ -15,6 +15,7 @@ import sys
from util.log import *
from util.cases import *
from util.sql import *
from util.types import TDSmlProtocolType, TDSmlTimestampType
class TDTestCase:
......@@ -46,7 +47,7 @@ class TDTestCase:
}
}
''']
code = self._conn.schemaless_insert(payload, 2, None)
code = self._conn.schemaless_insert(payload, TDSmlProtocolType.JSON.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("describe `.stb.0.`")
......@@ -67,7 +68,7 @@ class TDTestCase:
}
}
''']
code = self._conn.schemaless_insert(payload, 2, None)
code = self._conn.schemaless_insert(payload, TDSmlProtocolType.JSON.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("describe stb0_0")
......@@ -86,7 +87,7 @@ class TDTestCase:
}
}
''']
code = self._conn.schemaless_insert(payload, 2, None)
code = self._conn.schemaless_insert(payload, TDSmlProtocolType.JSON.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("describe stb0_1")
......@@ -105,7 +106,7 @@ class TDTestCase:
}
}
''']
code = self._conn.schemaless_insert(payload, 2, None)
code = self._conn.schemaless_insert(payload, TDSmlProtocolType.JSON.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("describe stb0_2")
......@@ -124,7 +125,7 @@ class TDTestCase:
}
}
''']
code = self._conn.schemaless_insert(payload, 2, None)
code = self._conn.schemaless_insert(payload, TDSmlProtocolType.JSON.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("describe stb0_3")
......@@ -143,7 +144,7 @@ class TDTestCase:
}
}
''']
code = self._conn.schemaless_insert(payload, 2, None)
code = self._conn.schemaless_insert(payload, TDSmlProtocolType.JSON.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("describe stb0_4")
......@@ -162,7 +163,7 @@ class TDTestCase:
}
}
''']
code = self._conn.schemaless_insert(payload, 2, None)
code = self._conn.schemaless_insert(payload, TDSmlProtocolType.JSON.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("describe stb0_5")
......@@ -184,7 +185,7 @@ class TDTestCase:
}
}
''']
code = self._conn.schemaless_insert(payload, 2, None)
code = self._conn.schemaless_insert(payload, TDSmlProtocolType.JSON.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
### timestamp 10 digits second ###
......@@ -201,7 +202,7 @@ class TDTestCase:
}
}
''']
code = self._conn.schemaless_insert(payload, 2, None)
code = self._conn.schemaless_insert(payload, TDSmlProtocolType.JSON.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
print("============= step3 : test tags ================")
......@@ -216,7 +217,7 @@ class TDTestCase:
}
}
''']
code = self._conn.schemaless_insert(payload, 2, None)
code = self._conn.schemaless_insert(payload, TDSmlProtocolType.JSON.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("describe stb0_8")
......@@ -232,7 +233,7 @@ class TDTestCase:
}
}
''']
code = self._conn.schemaless_insert(payload, 2, None)
code = self._conn.schemaless_insert(payload, TDSmlProtocolType.JSON.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("describe stb0_9")
......@@ -248,7 +249,7 @@ class TDTestCase:
}
}
''']
code = self._conn.schemaless_insert(payload, 2, None)
code = self._conn.schemaless_insert(payload, TDSmlProtocolType.JSON.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("describe stb0_10")
......@@ -274,7 +275,7 @@ class TDTestCase:
}
}
''']
code = self._conn.schemaless_insert(payload, 2, None)
code = self._conn.schemaless_insert(payload, TDSmlProtocolType.JSON.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("select ts from stb1_0")
......@@ -297,7 +298,7 @@ class TDTestCase:
}
}
''']
code = self._conn.schemaless_insert(payload, 2, None)
code = self._conn.schemaless_insert(payload, TDSmlProtocolType.JSON.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("select ts from stb1_1")
......@@ -320,7 +321,7 @@ class TDTestCase:
}
}
''']
code = self._conn.schemaless_insert(payload, 2, None)
code = self._conn.schemaless_insert(payload, TDSmlProtocolType.JSON.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("select ts from stb1_2")
......@@ -343,7 +344,7 @@ class TDTestCase:
}
}
''']
code = self._conn.schemaless_insert(payload, 2, None)
code = self._conn.schemaless_insert(payload, TDSmlProtocolType.JSON.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("select ts from stb1_3")
......@@ -367,7 +368,7 @@ class TDTestCase:
}
}
''']
code = self._conn.schemaless_insert(payload, 2, None)
code = self._conn.schemaless_insert(payload, TDSmlProtocolType.JSON.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
### metric value ###
......@@ -390,7 +391,7 @@ class TDTestCase:
}
}
''']
code = self._conn.schemaless_insert(payload, 2, None)
code = self._conn.schemaless_insert(payload, TDSmlProtocolType.JSON.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("describe stb2_0")
......@@ -415,7 +416,7 @@ class TDTestCase:
}
}
''']
code = self._conn.schemaless_insert(payload, 2, None)
code = self._conn.schemaless_insert(payload, TDSmlProtocolType.JSON.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("describe stb2_1")
......@@ -440,7 +441,7 @@ class TDTestCase:
}
}
''']
code = self._conn.schemaless_insert(payload, 2, None)
code = self._conn.schemaless_insert(payload, TDSmlProtocolType.JSON.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("describe stb2_2")
......@@ -465,7 +466,7 @@ class TDTestCase:
}
}
''']
code = self._conn.schemaless_insert(payload, 2, None)
code = self._conn.schemaless_insert(payload, TDSmlProtocolType.JSON.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("describe stb2_3")
......@@ -490,7 +491,7 @@ class TDTestCase:
}
}
''']
code = self._conn.schemaless_insert(payload, 2, None)
code = self._conn.schemaless_insert(payload, TDSmlProtocolType.JSON.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("describe stb2_4")
......@@ -515,7 +516,7 @@ class TDTestCase:
}
}
''']
code = self._conn.schemaless_insert(payload, 2, None)
code = self._conn.schemaless_insert(payload, TDSmlProtocolType.JSON.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("describe stb2_5")
......@@ -540,7 +541,7 @@ class TDTestCase:
}
}
''']
code = self._conn.schemaless_insert(payload, 2, None)
code = self._conn.schemaless_insert(payload, TDSmlProtocolType.JSON.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("describe stb2_6")
......@@ -565,7 +566,7 @@ class TDTestCase:
}
}
''']
code = self._conn.schemaless_insert(payload, 2, None)
code = self._conn.schemaless_insert(payload, TDSmlProtocolType.JSON.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("describe stb2_7")
......@@ -590,7 +591,7 @@ class TDTestCase:
}
}
''']
code = self._conn.schemaless_insert(payload, 2, None)
code = self._conn.schemaless_insert(payload, TDSmlProtocolType.JSON.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("describe stb2_8")
......@@ -649,7 +650,7 @@ class TDTestCase:
}
}
''']
code = self._conn.schemaless_insert(payload, 2, None)
code = self._conn.schemaless_insert(payload, TDSmlProtocolType.JSON.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("describe stb3_0")
......
......@@ -15,7 +15,7 @@ import sys
from util.log import *
from util.cases import *
from util.sql import *
from util.types import TDSmlProtocolType, TDSmlTimestampType
class TDTestCase:
def init(self, conn, logSql):
......@@ -39,7 +39,7 @@ class TDTestCase:
"`.stb0.3.` 1626006833639000000ns 4i8 host=\"host0\" interface=\"eth0\"",
]
code = self._conn.schemaless_insert(lines0, 1, None)
code = self._conn.schemaless_insert(lines0, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("show stables")
......@@ -69,7 +69,7 @@ class TDTestCase:
"stb1 0 7i8 host=\"host0\"",
]
code = self._conn.schemaless_insert(lines1, 1, None)
code = self._conn.schemaless_insert(lines1, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("select * from stb1")
......@@ -83,7 +83,7 @@ class TDTestCase:
"stb2_0 1626006833651ms -127i8 host=\"host0\"",
"stb2_0 1626006833652ms 127i8 host=\"host0\""
]
code = self._conn.schemaless_insert(lines2_0, 1, None)
code = self._conn.schemaless_insert(lines2_0, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("select * from stb2_0")
......@@ -98,7 +98,7 @@ class TDTestCase:
"stb2_1 1626006833651ms -32767i16 host=\"host0\"",
"stb2_1 1626006833652ms 32767i16 host=\"host0\""
]
code = self._conn.schemaless_insert(lines2_1, 1, None)
code = self._conn.schemaless_insert(lines2_1, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("select * from stb2_1")
......@@ -114,7 +114,7 @@ class TDTestCase:
"stb2_2 1626006833652ms 2147483647i32 host=\"host0\""
]
code = self._conn.schemaless_insert(lines2_2, 1, None)
code = self._conn.schemaless_insert(lines2_2, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("select * from stb2_2")
......@@ -130,7 +130,7 @@ class TDTestCase:
"stb2_3 1626006833652ms 9223372036854775807i64 host=\"host0\""
]
code = self._conn.schemaless_insert(lines2_3, 1, None)
code = self._conn.schemaless_insert(lines2_3, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("select * from stb2_3")
......@@ -154,7 +154,7 @@ class TDTestCase:
"stb2_4 1626006833710ms -3.4E38f32 host=\"host0\""
]
code = self._conn.schemaless_insert(lines2_4, 1, None)
code = self._conn.schemaless_insert(lines2_4, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("select * from stb2_4")
......@@ -179,7 +179,7 @@ class TDTestCase:
"stb2_5 1626006833710ms 3 host=\"host0\""
]
code = self._conn.schemaless_insert(lines2_5, 1, None)
code = self._conn.schemaless_insert(lines2_5, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("select * from stb2_5")
......@@ -203,7 +203,7 @@ class TDTestCase:
"stb2_6 1626006833700ms FALSE host=\"host0\""
]
code = self._conn.schemaless_insert(lines2_6, 1, None)
code = self._conn.schemaless_insert(lines2_6, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("select * from stb2_6")
......@@ -220,7 +220,7 @@ class TDTestCase:
"stb2_7 1626006833630ms \"binary_val.()[]{}<>\" host=\"host0\""
]
code = self._conn.schemaless_insert(lines2_7, 1, None)
code = self._conn.schemaless_insert(lines2_7, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("select * from stb2_7")
......@@ -236,7 +236,7 @@ class TDTestCase:
"stb2_8 1626006833620ms L\"nchar_val数值二\" host=\"host0\""
]
code = self._conn.schemaless_insert(lines2_8, 1, None)
code = self._conn.schemaless_insert(lines2_8, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("select * from stb2_8")
......@@ -254,7 +254,7 @@ class TDTestCase:
"stb3_0 1626006833610ms 2 t1=-127i8 t2=-32767i16 t3=-2147483647i32 t4=-9223372036854775807i64 t5=-3.4E38f32 t6=-1.7E308f64 t7=false t8=\"binary_val_2\" t9=L\"标签值2\""
]
code = self._conn.schemaless_insert(lines3_0, 1, None)
code = self._conn.schemaless_insert(lines3_0, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("select * from stb3_0")
......@@ -298,7 +298,7 @@ class TDTestCase:
"stb3_1 1626006833610ms 3 ID=child_table3 host=host3"
]
code = self._conn.schemaless_insert(lines3_1, 1, None)
code = self._conn.schemaless_insert(lines3_1, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.NOT_CONFIGURED.value)
print("schemaless_insert result {}".format(code))
tdSql.query("select * from stb3_1")
......
......@@ -15,13 +15,14 @@ import sys
from util.log import *
from util.cases import *
from util.sql import *
from util.types import TDSmlProtocolType, TDSmlTimestampType
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self._conn = conn
self._conn = conn
def run(self):
print("running {}".format(__file__))
......@@ -42,17 +43,17 @@ class TDTestCase:
"stf,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933641000000"
]
code = self._conn.schemaless_insert(lines, 0, "ns")
code = self._conn.schemaless_insert(lines, TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
print("schemaless_insert result {}".format(code))
lines2 = [ "stg,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000",
"stg,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64 1626006833640000000"
]
code = self._conn.schemaless_insert([ lines2[0] ], 0, "ns")
code = self._conn.schemaless_insert([ lines2[0] ], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
print("schemaless_insert result {}".format(code))
self._conn.schemaless_insert([ lines2[1] ], 0, "ns")
code = self._conn.schemaless_insert([ lines2[1] ], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
print("schemaless_insert result {}".format(code))
tdSql.query("select * from st")
......@@ -76,7 +77,7 @@ class TDTestCase:
self._conn.schemaless_insert([
"sth,t1=4i64,t2=5f64,t4=5f64,ID=childtable c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933641",
"sth,t1=4i64,t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933654"
], 0, "ms")
], TDSmlProtocolType.LINE.value, TDSmlTimestampType.MILLI_SECOND.value)
tdSql.execute('reset query cache')
tdSql.query('select tbname, * from sth')
......
......@@ -21,6 +21,7 @@ import numpy as np
from util.log import *
from util.cases import *
from util.sql import *
from util.types import TDSmlProtocolType, TDSmlTimestampType
import threading
......@@ -294,7 +295,7 @@ class TDTestCase:
def resCmp(self, input_sql, stb_name, query_sql="select * from", condition="", ts=None, id=True, none_check_tag=None):
expect_list = self.inputHandle(input_sql)
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
query_sql = f"{query_sql} {stb_name} {condition}"
res_row_list, res_field_list_without_ts, res_type_list = self.resHandle(query_sql, True)
if ts == 0:
......@@ -409,11 +410,11 @@ class TDTestCase:
"""
for input_sql in [self.genLongSql(128, 1)[0], self.genLongSql(1, 4094)[0]]:
self.cleanStb()
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
for input_sql in [self.genLongSql(129, 1)[0], self.genLongSql(1, 4095)[0]]:
self.cleanStb()
try:
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
except SchemalessError:
pass
......@@ -427,7 +428,7 @@ class TDTestCase:
for i in rstr:
input_sql = self.genFullTypeSql(tb_name=f"\"aaa{i}bbb\"")[0]
try:
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
except SchemalessError:
pass
......@@ -438,7 +439,7 @@ class TDTestCase:
self.cleanStb()
input_sql = self.genFullTypeSql(tb_name=f"\"1aaabbb\"")[0]
try:
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
except SchemalessError:
pass
......@@ -449,7 +450,7 @@ class TDTestCase:
self.cleanStb()
input_sql = self.genFullTypeSql(ts="now")[0]
try:
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
except SchemalessError:
pass
......@@ -460,7 +461,7 @@ class TDTestCase:
self.cleanStb()
input_sql = self.genFullTypeSql(ts="2021-07-21\ 19:01:46.920")[0]
try:
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
except SchemalessError:
pass
......@@ -471,7 +472,7 @@ class TDTestCase:
self.cleanStb()
input_sql = self.genFullTypeSql(ts="16260068336390us19")[0]
try:
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
except SchemalessError:
pass
......@@ -487,7 +488,7 @@ class TDTestCase:
for t1 in ["-128i8", "128i8"]:
input_sql = self.genFullTypeSql(t1=t1)[0]
try:
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
except SchemalessError:
pass
......@@ -498,7 +499,7 @@ class TDTestCase:
for t2 in ["-32768i16", "32768i16"]:
input_sql = self.genFullTypeSql(t2=t2)[0]
try:
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
except SchemalessError:
pass
......@@ -509,7 +510,7 @@ class TDTestCase:
for t3 in ["-2147483648i32", "2147483648i32"]:
input_sql = self.genFullTypeSql(t3=t3)[0]
try:
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
except SchemalessError:
pass
......@@ -520,7 +521,7 @@ class TDTestCase:
for t4 in ["-9223372036854775808i64", "9223372036854775808i64"]:
input_sql = self.genFullTypeSql(t4=t4)[0]
try:
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
except SchemalessError:
pass
......@@ -532,7 +533,7 @@ class TDTestCase:
for t5 in [f"{-3.4028234664*(10**38)}f32", f"{3.4028234664*(10**38)}f32"]:
input_sql = self.genFullTypeSql(t5=t5)[0]
try:
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
raise Exception("should not reach here")
except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0)
......@@ -546,7 +547,7 @@ class TDTestCase:
for c6 in [f'{-1.797693134862316*(10**308)}f64', f'{-1.797693134862316*(10**308)}f64']:
input_sql = self.genFullTypeSql(c6=c6)[0]
try:
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
raise Exception("should not reach here")
except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0)
......@@ -554,11 +555,11 @@ class TDTestCase:
# binary
stb_name = self.getLongName(7, "letters")
input_sql = f'{stb_name},t0=t,t1="{self.getLongName(16374, "letters")}" c0=f 1626006833639000000ns'
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
input_sql = f'{stb_name},t0=t,t1="{self.getLongName(16375, "letters")}" c0=f 1626006833639000000ns'
try:
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
raise Exception("should not reach here")
except SchemalessError as err:
pass
......@@ -567,11 +568,11 @@ class TDTestCase:
# * legal nchar could not be larger than 16374/4
stb_name = self.getLongName(7, "letters")
input_sql = f'{stb_name},t0=t,t1=L"{self.getLongName(4093, "letters")}" c0=f 1626006833639000000ns'
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
input_sql = f'{stb_name},t0=t,t1=L"{self.getLongName(4094, "letters")}" c0=f 1626006833639000000ns'
try:
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
raise Exception("should not reach here")
except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0)
......@@ -589,7 +590,7 @@ class TDTestCase:
for c1 in ["-128i8", "128i8"]:
input_sql = self.genFullTypeSql(c1=c1)[0]
try:
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
raise Exception("should not reach here")
except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0)
......@@ -600,7 +601,7 @@ class TDTestCase:
for c2 in ["-32768i16", "32768i16"]:
input_sql = self.genFullTypeSql(c2=c2)[0]
try:
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
raise Exception("should not reach here")
except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0)
......@@ -612,7 +613,7 @@ class TDTestCase:
for c3 in ["-2147483648i32", "2147483648i32"]:
input_sql = self.genFullTypeSql(c3=c3)[0]
try:
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
raise Exception("should not reach here")
except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0)
......@@ -624,7 +625,7 @@ class TDTestCase:
for c4 in ["-9223372036854775808i64", "9223372036854775808i64"]:
input_sql = self.genFullTypeSql(c4=c4)[0]
try:
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
raise Exception("should not reach here")
except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0)
......@@ -637,7 +638,7 @@ class TDTestCase:
for c5 in [f"{-3.4028234664*(10**38)}f32", f"{3.4028234664*(10**38)}f32"]:
input_sql = self.genFullTypeSql(c5=c5)[0]
try:
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
raise Exception("should not reach here")
except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0)
......@@ -650,7 +651,7 @@ class TDTestCase:
for c6 in [f'{-1.797693134862316*(10**308)}f64', f'{-1.797693134862316*(10**308)}f64']:
input_sql = self.genFullTypeSql(c6=c6)[0]
try:
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
raise Exception("should not reach here")
except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0)
......@@ -658,11 +659,11 @@ class TDTestCase:
# # binary
stb_name = self.getLongName(7, "letters")
input_sql = f'{stb_name},t0=t c0=f,c1="{self.getLongName(16374, "letters")}" 1626006833639000000ns'
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
input_sql = f'{stb_name},t0=t c0=f,c1="{self.getLongName(16375, "letters")}" 1626006833639000000ns'
try:
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
raise Exception("should not reach here")
except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0)
......@@ -671,11 +672,11 @@ class TDTestCase:
# * legal nchar could not be larger than 16374/4
stb_name = self.getLongName(7, "letters")
input_sql = f'{stb_name},t0=t c0=f,c1=L"{self.getLongName(4093, "letters")}" 1626006833639000000ns'
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
input_sql = f'{stb_name},t0=t c0=f,c1=L"{self.getLongName(4094, "letters")}" 1626006833639000000ns'
try:
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
raise Exception("should not reach here")
except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0)
......@@ -690,13 +691,13 @@ class TDTestCase:
for i in ["TrUe", "tRue", "trUe", "truE", "FalsE", "fAlse", "faLse", "falSe", "falsE"]:
input_sql1 = self.genFullTypeSql(t0=i)[0]
try:
self._conn.schemaless_insert([input_sql1], 0)
self._conn.schemaless_insert([input_sql1], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
raise Exception("should not reach here")
except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0)
input_sql2 = self.genFullTypeSql(c0=i)[0]
try:
self._conn.schemaless_insert([input_sql2], 0)
self._conn.schemaless_insert([input_sql2], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
raise Exception("should not reach here")
except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0)
......@@ -718,7 +719,7 @@ class TDTestCase:
self.genFullTypeSql(c9="1s1u64")[0]
]:
try:
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
raise Exception("should not reach here")
except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0)
......@@ -731,7 +732,7 @@ class TDTestCase:
input_sql4 = f'{stb_name},t0=t,t1=L"abc aaa" c0=f 1626006833639000000ns'
for input_sql in [input_sql1, input_sql2, input_sql3, input_sql4]:
try:
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
raise Exception("should not reach here")
except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0)
......@@ -741,8 +742,8 @@ class TDTestCase:
for symbol in list('~!@#$¥%^&*()-+={}|[]、「」:;'):
input_sql1 = f'{stb_name},t0=t c0=f,c1="abc{symbol}aaa" 1626006833639000000ns'
input_sql2 = f'{stb_name},t0=t,t1="abc{symbol}aaa" c0=f 1626006833639000000ns'
self._conn.schemaless_insert([input_sql1], 0)
self._conn.schemaless_insert([input_sql2], 0)
self._conn.schemaless_insert([input_sql1], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
self._conn.schemaless_insert([input_sql2], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
def duplicateIdTagColInsertCheckCase(self):
......@@ -752,7 +753,7 @@ class TDTestCase:
self.cleanStb()
input_sql_id = self.genFullTypeSql(id_double_tag=True)[0]
try:
self._conn.schemaless_insert([input_sql_id], 0)
self._conn.schemaless_insert([input_sql_id], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
raise Exception("should not reach here")
except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0)
......@@ -760,7 +761,7 @@ class TDTestCase:
input_sql = self.genFullTypeSql()[0]
input_sql_tag = input_sql.replace("t5", "t6")
try:
self._conn.schemaless_insert([input_sql_tag], 0)
self._conn.schemaless_insert([input_sql_tag], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
raise Exception("should not reach here")
except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0)
......@@ -768,7 +769,7 @@ class TDTestCase:
input_sql = self.genFullTypeSql()[0]
input_sql_col = input_sql.replace("c5", "c6")
try:
self._conn.schemaless_insert([input_sql_col], 0)
self._conn.schemaless_insert([input_sql_col], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
raise Exception("should not reach here")
except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0)
......@@ -776,7 +777,7 @@ class TDTestCase:
input_sql = self.genFullTypeSql()[0]
input_sql_col = input_sql.replace("c5", "C6")
try:
self._conn.schemaless_insert([input_sql_col], 0)
self._conn.schemaless_insert([input_sql_col], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
raise Exception("should not reach here")
except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0)
......@@ -802,7 +803,7 @@ class TDTestCase:
self.cleanStb()
input_sql, stb_name = self.genFullTypeSql()
self.resCmp(input_sql, stb_name)
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
self.resCmp(input_sql, stb_name)
def tagColBinaryNcharLengthCheckCase(self):
......@@ -869,7 +870,7 @@ class TDTestCase:
tdSql.checkRows(1)
tdSql.checkEqual(tb_name1, tb_name2)
input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, t0="f", c0="f", id_noexist_tag=True, ct_add_tag=True)
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
tb_name3 = self.getNoIdTbName(stb_name)
tdSql.query(f"select * from {stb_name}")
tdSql.checkRows(2)
......@@ -884,17 +885,17 @@ class TDTestCase:
stb_name = self.getLongName(7, "letters")
tb_name = f'{stb_name}_1'
input_sql = f'{stb_name},id="{tb_name}",t0=t c0=f 1626006833639000000ns'
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
# * every binary and nchar must be length+2, so here is two tag, max length could not larger than 16384-2*2
input_sql = f'{stb_name},t0=t,t1="{self.getLongName(16374, "letters")}",t2="{self.getLongName(5, "letters")}" c0=f 1626006833639000000ns'
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
tdSql.query(f"select * from {stb_name}")
tdSql.checkRows(2)
input_sql = f'{stb_name},t0=t,t1="{self.getLongName(16374, "letters")}",t2="{self.getLongName(6, "letters")}" c0=f 1626006833639000000ns'
try:
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
raise Exception("should not reach here")
except SchemalessError:
pass
......@@ -903,13 +904,13 @@ class TDTestCase:
# # * check col,col+ts max in describe ---> 16143
input_sql = f'{stb_name},t0=t c0=f,c1="{self.getLongName(16374, "letters")}",c2="{self.getLongName(16374, "letters")}",c3="{self.getLongName(16374, "letters")}",c4="{self.getLongName(12, "letters")}" 1626006833639000000ns'
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
tdSql.query(f"select * from {stb_name}")
tdSql.checkRows(3)
input_sql = f'{stb_name},t0=t c0=f,c1="{self.getLongName(16374, "letters")}",c2="{self.getLongName(16374, "letters")}",c3="{self.getLongName(16374, "letters")}",c4="{self.getLongName(13, "letters")}" 1626006833639000000ns'
try:
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
raise Exception("should not reach here")
except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0)
......@@ -925,16 +926,16 @@ class TDTestCase:
stb_name = self.getLongName(7, "letters")
tb_name = f'{stb_name}_1'
input_sql = f'{stb_name},id="{tb_name}",t0=t c0=f 1626006833639000000ns'
code = self._conn.schemaless_insert([input_sql], 0)
code = self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
# * legal nchar could not be larger than 16374/4
input_sql = f'{stb_name},t0=t,t1=L"{self.getLongName(4093, "letters")}",t2=L"{self.getLongName(1, "letters")}" c0=f 1626006833639000000ns'
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
tdSql.query(f"select * from {stb_name}")
tdSql.checkRows(2)
input_sql = f'{stb_name},t0=t,t1=L"{self.getLongName(4093, "letters")}",t2=L"{self.getLongName(2, "letters")}" c0=f 1626006833639000000ns'
try:
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
raise Exception("should not reach here")
except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0)
......@@ -942,12 +943,12 @@ class TDTestCase:
tdSql.checkRows(2)
input_sql = f'{stb_name},t0=t c0=f,c1=L"{self.getLongName(4093, "letters")}",c2=L"{self.getLongName(4093, "letters")}",c3=L"{self.getLongName(4093, "letters")}",c4=L"{self.getLongName(4, "letters")}" 1626006833639000000ns'
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
tdSql.query(f"select * from {stb_name}")
tdSql.checkRows(3)
input_sql = f'{stb_name},t0=t c0=f,c1=L"{self.getLongName(4093, "letters")}",c2=L"{self.getLongName(4093, "letters")}",c3=L"{self.getLongName(4093, "letters")}",c4=L"{self.getLongName(5, "letters")}" 1626006833639000000ns'
try:
self._conn.schemaless_insert([input_sql], 0)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
raise Exception("should not reach here")
except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0)
......@@ -971,7 +972,7 @@ class TDTestCase:
"st123456,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64,c6=7u64 1626006933640000000ns",
"st123456,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933641000000ns"
]
self._conn.schemaless_insert(lines, 0)
self._conn.schemaless_insert(lines, TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
def multiInsertCheckCase(self, count):
"""
......@@ -984,7 +985,7 @@ class TDTestCase:
for i in range(count):
input_sql = self.genFullTypeSql(stb_name=stb_name, t7=f'"{self.getLongName(8, "letters")}"', c7=f'"{self.getLongName(8, "letters")}"', id_noexist_tag=True)[0]
sql_list.append(input_sql)
self._conn.schemaless_insert(sql_list, 0)
self._conn.schemaless_insert(sql_list, TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
def batchErrorInsertCheckCase(self):
"""
......@@ -995,7 +996,7 @@ class TDTestCase:
lines = ["st123456,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000ns",
f"{stb_name},t2=5f64,t3=L\"ste\" c1=tRue,c2=4i64,c3=\"iam\" 1626056811823316532ns"]
try:
self._conn.schemaless_insert(lines, 0)
self._conn.schemaless_insert(lines, TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
raise Exception("should not reach here")
except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0)
......@@ -1049,7 +1050,7 @@ class TDTestCase:
def genMultiThreadSeq(self, sql_list):
tlist = list()
for insert_sql in sql_list:
t = threading.Thread(target=self._conn.schemaless_insert,args=([insert_sql[0]], 0))
t = threading.Thread(target=self._conn.schemaless_insert,args=([insert_sql[0]], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value))
tlist.append(t)
return tlist
......@@ -1260,8 +1261,8 @@ class TDTestCase:
input_sql1 = "rfasta,id=\"rfasta_1\",t0=true,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"ddzhiksj\",t8=L\"ncharTagValue\" c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"bnhwlgvj\",c8=L\"ncharTagValue\",c9=7u64 1626006933640000000ns"
input_sql2 = "rfasta,id=\"rfasta_1\",t0=true,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64 c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64 1626006933640000000ns"
try:
self._conn.schemaless_insert([input_sql1], 0)
self._conn.schemaless_insert([input_sql2], 0)
self._conn.schemaless_insert([input_sql1], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
self._conn.schemaless_insert([input_sql2], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
except SchemalessError as err:
print(err.errno)
# self._conn.schemaless_insert([input_sql2], 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册