This commit is contained in:
cpwu 2022-08-31 11:00:25 +08:00
parent ec02d230d2
commit 2fc2000c7a
4 changed files with 183 additions and 183 deletions

View File

@ -208,11 +208,11 @@ class TDCom:
stb_list = map(lambda x: x[0], res_row_list) stb_list = map(lambda x: x[0], res_row_list)
for stb in stb_list: for stb in stb_list:
if type == "taosc": if type == "taosc":
tdSql.execute(f'drop table if exists `{dbname}.{stb}`') tdSql.execute(f'drop table if exists {dbname}.`{stb}`')
if not stb[0].isdigit(): if not stb[0].isdigit():
tdSql.execute(f'drop table if exists {dbname}.{stb}') tdSql.execute(f'drop table if exists {dbname}.{stb}')
elif type == "restful": elif type == "restful":
self.restApiPost(f"drop table if exists `{dbname}.{stb}`") self.restApiPost(f"drop table if exists {dbname}.`{stb}`")
if not stb[0].isdigit(): if not stb[0].isdigit():
self.restApiPost(f"drop table if exists {dbname}.{stb}") self.restApiPost(f"drop table if exists {dbname}.{stb}")

View File

@ -31,7 +31,7 @@ if platform.system().lower() == 'windows':
class TDTestCase: class TDTestCase:
def init(self, conn, logSql): def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__) tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql) tdSql.init(conn.cursor(), False)
self._conn = conn self._conn = conn
def createDb(self, name="test", db_update_tag=0): def createDb(self, name="test", db_update_tag=0):
@ -357,7 +357,7 @@ class TDTestCase:
""" """
normal tags and cols, one for every elm normal tags and cols, one for every elm
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql() input_sql, stb_name = self.genFullTypeSql()
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
@ -365,7 +365,7 @@ class TDTestCase:
""" """
check all normal type check all normal type
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
full_type_list = ["f", "F", "false", "False", "t", "T", "true", "True"] full_type_list = ["f", "F", "false", "False", "t", "T", "true", "True"]
for t_type in full_type_list: for t_type in full_type_list:
input_sql, stb_name = self.genFullTypeSql(c0=t_type, t0=t_type) input_sql, stb_name = self.genFullTypeSql(c0=t_type, t0=t_type)
@ -379,7 +379,7 @@ class TDTestCase:
please test : please test :
binary_symbols = '\"abcd`~!@#$%^&*()_-{[}]|:;<.>?lfjal"\'\'"\"' binary_symbols = '\"abcd`~!@#$%^&*()_-{[}]|:;<.>?lfjal"\'\'"\"'
''' '''
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
binary_symbols = '"abcd`~!@#$%^&*()_-{[}]|:;<.>?lfjal"' binary_symbols = '"abcd`~!@#$%^&*()_-{[}]|:;<.>?lfjal"'
nchar_symbols = f'L{binary_symbols}' nchar_symbols = f'L{binary_symbols}'
input_sql, stb_name = self.genFullTypeSql(c7=binary_symbols, c8=nchar_symbols, t7=binary_symbols, t8=nchar_symbols) input_sql, stb_name = self.genFullTypeSql(c7=binary_symbols, c8=nchar_symbols, t7=binary_symbols, t8=nchar_symbols)
@ -390,7 +390,7 @@ class TDTestCase:
test ts list --> ["1626006833639000000", "1626006833639019us", "1626006833640ms", "1626006834s", "1626006822639022"] test ts list --> ["1626006833639000000", "1626006833639019us", "1626006833640ms", "1626006834s", "1626006822639022"]
# ! us级时间戳都为0时数据库中查询显示但python接口拿到的结果不显示 .000000的情况请确认,目前修改时间处理代码可以通过 # ! us级时间戳都为0时数据库中查询显示但python接口拿到的结果不显示 .000000的情况请确认,目前修改时间处理代码可以通过
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
ts_list = ["1626006833639000000", "1626006833639019us", "1626006833640ms", "1626006834s", "1626006822639022", 0] ts_list = ["1626006833639000000", "1626006833639019us", "1626006833640ms", "1626006834s", "1626006822639022", 0]
for ts in ts_list: for ts in ts_list:
input_sql, stb_name = self.genFullTypeSql(ts=ts) input_sql, stb_name = self.genFullTypeSql(ts=ts)
@ -401,7 +401,7 @@ class TDTestCase:
check id.index in tags check id.index in tags
eg: t0=**,id=**,t1=** eg: t0=**,id=**,t1=**
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql(id_change_tag=True) input_sql, stb_name = self.genFullTypeSql(id_change_tag=True)
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
@ -410,7 +410,7 @@ class TDTestCase:
check id param check id param
eg: id and ID eg: id and ID
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql(id_upper_tag=True) input_sql, stb_name = self.genFullTypeSql(id_upper_tag=True)
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
input_sql, stb_name = self.genFullTypeSql(id_change_tag=True, id_upper_tag=True) input_sql, stb_name = self.genFullTypeSql(id_change_tag=True, id_upper_tag=True)
@ -420,7 +420,7 @@ class TDTestCase:
""" """
id not exist id not exist
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql(id_noexist_tag=True) input_sql, stb_name = self.genFullTypeSql(id_noexist_tag=True)
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
query_sql = f"select tbname from {stb_name}" query_sql = f"select tbname from {stb_name}"
@ -436,10 +436,10 @@ class TDTestCase:
max col count is ?? max col count is ??
""" """
for input_sql in [self.genLongSql(127, 1)[0], self.genLongSql(1, 4093)[0]]: for input_sql in [self.genLongSql(127, 1)[0], self.genLongSql(1, 4093)[0]]:
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value) 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]]: for input_sql in [self.genLongSql(129, 1)[0], self.genLongSql(1, 4095)[0]]:
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
try: try:
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value) self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
except SchemalessError as err: except SchemalessError as err:
@ -450,7 +450,7 @@ class TDTestCase:
test illegal id name test illegal id name
mix "~!@#$¥%^&*()-+|[]、「」【】;:《》<>?" mix "~!@#$¥%^&*()-+|[]、「」【】;:《》<>?"
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
rstr = list("~!@#$¥%^&*()-+|[]、「」【】;:《》<>?") rstr = list("~!@#$¥%^&*()-+|[]、「」【】;:《》<>?")
for i in rstr: for i in rstr:
stb_name=f"aaa{i}bbb" stb_name=f"aaa{i}bbb"
@ -462,7 +462,7 @@ class TDTestCase:
""" """
id is start with num id is start with num
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql = self.genFullTypeSql(tb_name=f"\"1aaabbb\"")[0] input_sql = self.genFullTypeSql(tb_name=f"\"1aaabbb\"")[0]
try: try:
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value) self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
@ -473,7 +473,7 @@ class TDTestCase:
""" """
check now unsupported check now unsupported
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql = self.genFullTypeSql(ts="now")[0] input_sql = self.genFullTypeSql(ts="now")[0]
try: try:
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value) self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
@ -484,7 +484,7 @@ class TDTestCase:
""" """
check date format ts unsupported check date format ts unsupported
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql = self.genFullTypeSql(ts="2021-07-21\ 19:01:46.920")[0] input_sql = self.genFullTypeSql(ts="2021-07-21\ 19:01:46.920")[0]
try: try:
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value) self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
@ -495,7 +495,7 @@ class TDTestCase:
""" """
check ts format like 16260068336390us19 check ts format like 16260068336390us19
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql = self.genFullTypeSql(ts="16260068336390us19")[0] input_sql = self.genFullTypeSql(ts="16260068336390us19")[0]
try: try:
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value) self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
@ -506,7 +506,7 @@ class TDTestCase:
""" """
check full type tag value limit check full type tag value limit
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
# i8 # i8
for t1 in ["-128i8", "127i8"]: for t1 in ["-128i8", "127i8"]:
input_sql, stb_name = self.genFullTypeSql(t1=t1) input_sql, stb_name = self.genFullTypeSql(t1=t1)
@ -602,7 +602,7 @@ class TDTestCase:
""" """
check full type col value limit check full type col value limit
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
# i8 # i8
for c1 in ["-128i8", "127i8"]: for c1 in ["-128i8", "127i8"]:
input_sql, stb_name = self.genFullTypeSql(c1=c1) input_sql, stb_name = self.genFullTypeSql(c1=c1)
@ -699,7 +699,7 @@ class TDTestCase:
""" """
test illegal tag col value test illegal tag col value
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
# bool # bool
for i in ["TrUe", "tRue", "trUe", "truE", "FalsE", "fAlse", "faLse", "falSe", "falsE"]: for i in ["TrUe", "tRue", "trUe", "truE", "FalsE", "fAlse", "faLse", "falSe", "falsE"]:
input_sql1 = self.genFullTypeSql(t0=i)[0] input_sql1 = self.genFullTypeSql(t0=i)[0]
@ -758,7 +758,7 @@ class TDTestCase:
""" """
check duplicate Id Tag Col check duplicate Id Tag Col
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql_id = self.genFullTypeSql(id_double_tag=True)[0] input_sql_id = self.genFullTypeSql(id_double_tag=True)[0]
try: try:
self._conn.schemaless_insert([input_sql_id], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value) self._conn.schemaless_insert([input_sql_id], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
@ -792,7 +792,7 @@ class TDTestCase:
""" """
case no id when stb exist case no id when stb exist
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql(tb_name="sub_table_0123456", t0="f", c0="f") input_sql, stb_name = self.genFullTypeSql(tb_name="sub_table_0123456", t0="f", c0="f")
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, id_noexist_tag=True, t0="f", c0="f") input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, id_noexist_tag=True, t0="f", c0="f")
@ -805,7 +805,7 @@ class TDTestCase:
""" """
check duplicate insert when stb exist check duplicate insert when stb exist
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql() input_sql, stb_name = self.genFullTypeSql()
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value) self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
@ -816,7 +816,7 @@ class TDTestCase:
""" """
check length increase check length increase
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql() input_sql, stb_name = self.genFullTypeSql()
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
tb_name = tdCom.getLongName(5, "letters") tb_name = tdCom.getLongName(5, "letters")
@ -833,7 +833,7 @@ class TDTestCase:
* col is added without value when update==0 * col is added without value when update==0
* col is added with value when update==1 * col is added with value when update==1
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
tb_name = tdCom.getLongName(7, "letters") tb_name = tdCom.getLongName(7, "letters")
for db_update_tag in [0, 1]: for db_update_tag in [0, 1]:
if db_update_tag == 1 : if db_update_tag == 1 :
@ -850,7 +850,7 @@ class TDTestCase:
""" """
check column and tag count add check column and tag count add
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
tb_name = tdCom.getLongName(7, "letters") tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, t0="f", c0="f") input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, t0="f", c0="f")
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
@ -866,7 +866,7 @@ class TDTestCase:
condition: stb not change condition: stb not change
insert two table, keep tag unchange, change col insert two table, keep tag unchange, change col
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql(t0="f", c0="f", id_noexist_tag=True) input_sql, stb_name = self.genFullTypeSql(t0="f", c0="f", id_noexist_tag=True)
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
tb_name1 = self.getNoIdTbName(stb_name) tb_name1 = self.getNoIdTbName(stb_name)
@ -888,7 +888,7 @@ class TDTestCase:
""" """
every binary and nchar must be length+2 every binary and nchar must be length+2
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
stb_name = tdCom.getLongName(7, "letters") stb_name = tdCom.getLongName(7, "letters")
tb_name = f'{stb_name}_1' tb_name = f'{stb_name}_1'
input_sql = f'{stb_name},id="{tb_name}",t0=t c0=f 1626006833639000000' input_sql = f'{stb_name},id="{tb_name}",t0=t c0=f 1626006833639000000'
@ -928,7 +928,7 @@ class TDTestCase:
""" """
check nchar length limit check nchar length limit
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
stb_name = tdCom.getLongName(7, "letters") stb_name = tdCom.getLongName(7, "letters")
tb_name = f'{stb_name}_1' tb_name = f'{stb_name}_1'
input_sql = f'{stb_name},id="{tb_name}",t0=t c0=f 1626006833639000000' input_sql = f'{stb_name},id="{tb_name}",t0=t c0=f 1626006833639000000'
@ -963,7 +963,7 @@ class TDTestCase:
""" """
test batch insert test batch insert
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
stb_name = tdCom.getLongName(8, "letters") stb_name = tdCom.getLongName(8, "letters")
# tdSql.execute(f'create stable {stb_name}(ts timestamp, f int) tags(t1 bigint)') # tdSql.execute(f'create stable {stb_name}(ts timestamp, f int) tags(t1 bigint)')
lines = ["st123456,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000", lines = ["st123456,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000",
@ -982,7 +982,7 @@ class TDTestCase:
""" """
test multi insert test multi insert
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
sql_list = [] sql_list = []
stb_name = tdCom.getLongName(8, "letters") stb_name = tdCom.getLongName(8, "letters")
# tdSql.execute(f'create stable {stb_name}(ts timestamp, f int) tags(t1 bigint)') # tdSql.execute(f'create stable {stb_name}(ts timestamp, f int) tags(t1 bigint)')
@ -996,7 +996,7 @@ class TDTestCase:
""" """
test batch error insert test batch error insert
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
stb_name = tdCom.getLongName(8, "letters") stb_name = tdCom.getLongName(8, "letters")
lines = ["st123456,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000", lines = ["st123456,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000",
f"{stb_name},t2=5f64,t3=L\"ste\" c1=tRue,c2=4i64,c3=\"iam\" 1626056811823316532ns"] f"{stb_name},t2=5f64,t3=L\"ste\" c1=tRue,c2=4i64,c3=\"iam\" 1626056811823316532ns"]
@ -1068,7 +1068,7 @@ class TDTestCase:
""" """
thread input different stb thread input different stb
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql = self.genSqlList()[0] input_sql = self.genSqlList()[0]
self.multiThreadRun(self.genMultiThreadSeq(input_sql)) self.multiThreadRun(self.genMultiThreadSeq(input_sql))
tdSql.query(f"show tables;") tdSql.query(f"show tables;")
@ -1078,7 +1078,7 @@ class TDTestCase:
""" """
thread input same stb tb, different data, result keep first data thread input same stb tb, different data, result keep first data
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
tb_name = tdCom.getLongName(7, "letters") tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name) input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name)
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
@ -1095,7 +1095,7 @@ class TDTestCase:
""" """
thread input same stb tb, different data, add columes and tags, result keep first data thread input same stb tb, different data, add columes and tags, result keep first data
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
tb_name = tdCom.getLongName(7, "letters") tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name) input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name)
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
@ -1112,7 +1112,7 @@ class TDTestCase:
""" """
thread input same stb tb, different data, minus columes and tags, result keep first data thread input same stb tb, different data, minus columes and tags, result keep first data
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
tb_name = tdCom.getLongName(7, "letters") tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name) input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name)
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
@ -1129,7 +1129,7 @@ class TDTestCase:
""" """
thread input same stb, different tb, different data thread input same stb, different tb, different data
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql() input_sql, stb_name = self.genFullTypeSql()
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
s_stb_d_tb_list = self.genSqlList(stb_name=stb_name)[4] s_stb_d_tb_list = self.genSqlList(stb_name=stb_name)[4]
@ -1144,7 +1144,7 @@ class TDTestCase:
""" """
thread input same stb, different tb, different data, add col, mul tag thread input same stb, different tb, different data, add col, mul tag
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql() input_sql, stb_name = self.genFullTypeSql()
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
s_stb_d_tb_a_col_m_tag_list = self.genSqlList(stb_name=stb_name)[5] s_stb_d_tb_a_col_m_tag_list = self.genSqlList(stb_name=stb_name)[5]
@ -1159,7 +1159,7 @@ class TDTestCase:
""" """
thread input same stb, different tb, different data, add tag, mul col thread input same stb, different tb, different data, add tag, mul col
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql() input_sql, stb_name = self.genFullTypeSql()
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
s_stb_d_tb_a_tag_m_col_list = self.genSqlList(stb_name=stb_name)[6] s_stb_d_tb_a_tag_m_col_list = self.genSqlList(stb_name=stb_name)[6]
@ -1171,7 +1171,7 @@ class TDTestCase:
""" """
thread input same stb tb, different ts thread input same stb tb, different ts
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
tb_name = tdCom.getLongName(7, "letters") tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name) input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name)
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
@ -1186,7 +1186,7 @@ class TDTestCase:
""" """
thread input same stb tb, different ts, add col, mul tag thread input same stb tb, different ts, add col, mul tag
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
tb_name = tdCom.getLongName(7, "letters") tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name) input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name)
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
@ -1205,7 +1205,7 @@ class TDTestCase:
""" """
thread input same stb tb, different ts, add tag, mul col thread input same stb tb, different ts, add tag, mul col
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
tb_name = tdCom.getLongName(7, "letters") tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name) input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name)
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
@ -1226,7 +1226,7 @@ class TDTestCase:
""" """
thread input same stb, different tb, data, ts thread input same stb, different tb, data, ts
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql() input_sql, stb_name = self.genFullTypeSql()
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
s_stb_d_tb_d_ts_list = self.genSqlList(stb_name=stb_name)[10] s_stb_d_tb_d_ts_list = self.genSqlList(stb_name=stb_name)[10]
@ -1241,7 +1241,7 @@ class TDTestCase:
""" """
thread input same stb, different tb, data, ts, add col, mul tag thread input same stb, different tb, data, ts, add col, mul tag
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql() input_sql, stb_name = self.genFullTypeSql()
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
s_stb_d_tb_d_ts_a_col_m_tag_list = self.genSqlList(stb_name=stb_name)[11] s_stb_d_tb_d_ts_a_col_m_tag_list = self.genSqlList(stb_name=stb_name)[11]

View File

@ -459,7 +459,7 @@ class TDTestCase:
normal tags and cols, one for every elm normal tags and cols, one for every elm
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_json, stb_name = self.genFullTypeJson(value_type=value_type) input_json, stb_name = self.genFullTypeJson(value_type=value_type)
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
@ -468,7 +468,7 @@ class TDTestCase:
check all normal type check all normal type
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
full_type_list = ["f", "F", "false", "False", "t", "T", "true", "True"] full_type_list = ["f", "F", "false", "False", "t", "T", "true", "True"]
for t_type in full_type_list: for t_type in full_type_list:
input_json_list = [self.genFullTypeJson(tag_value=self.genTagValue(t0_value=t_type))[0], input_json_list = [self.genFullTypeJson(tag_value=self.genTagValue(t0_value=t_type))[0],
@ -489,7 +489,7 @@ class TDTestCase:
binary_symbols = '\"abcd`~!@#$%^&*()_-{[}]|:;<.>?lfjal"\'\'"\"' binary_symbols = '\"abcd`~!@#$%^&*()_-{[}]|:;<.>?lfjal"\'\'"\"'
''' '''
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
binary_symbols = '"abcd`~!@#$%^&*()_-{[}]|:;<.>?lfjal"' binary_symbols = '"abcd`~!@#$%^&*()_-{[}]|:;<.>?lfjal"'
nchar_symbols = binary_symbols nchar_symbols = binary_symbols
input_sql1, stb_name1 = self.genFullTypeJson(col_value=self.genTsColValue(value=binary_symbols, t_type="binary", value_type=value_type), input_sql1, stb_name1 = self.genFullTypeJson(col_value=self.genTsColValue(value=binary_symbols, t_type="binary", value_type=value_type),
@ -505,7 +505,7 @@ class TDTestCase:
# ! us级时间戳都为0时数据库中查询显示但python接口拿到的结果不显示 .000000的情况请确认,目前修改时间处理代码可以通过 # ! us级时间戳都为0时数据库中查询显示但python接口拿到的结果不显示 .000000的情况请确认,目前修改时间处理代码可以通过
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
ts_list = ["1626006833639000000ns", "1626006833639019us", "1626006833640ms", "1626006834s", "1626006834", 0] ts_list = ["1626006833639000000ns", "1626006833639019us", "1626006833640ms", "1626006834s", "1626006834", 0]
for ts in ts_list: for ts in ts_list:
if "s" in str(ts): if "s" in str(ts):
@ -571,7 +571,7 @@ class TDTestCase:
eg: t0=**,id=**,t1=** eg: t0=**,id=**,t1=**
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_json, stb_name = self.genFullTypeJson(id_change_tag=True, value_type=value_type) input_json, stb_name = self.genFullTypeJson(id_change_tag=True, value_type=value_type)
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
@ -581,7 +581,7 @@ class TDTestCase:
eg: id and ID eg: id and ID
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_json, stb_name = self.genFullTypeJson(id_upper_tag=True, value_type=value_type) input_json, stb_name = self.genFullTypeJson(id_upper_tag=True, value_type=value_type)
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
input_json, stb_name = self.genFullTypeJson(id_mixul_tag=True, value_type=value_type) input_json, stb_name = self.genFullTypeJson(id_mixul_tag=True, value_type=value_type)
@ -594,7 +594,7 @@ class TDTestCase:
id not exist id not exist
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_json, stb_name = self.genFullTypeJson(id_noexist_tag=True, value_type=value_type) input_json, stb_name = self.genFullTypeJson(id_noexist_tag=True, value_type=value_type)
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
query_sql = f"select tbname from {stb_name}" query_sql = f"select tbname from {stb_name}"
@ -610,10 +610,10 @@ class TDTestCase:
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
for input_json in [self.genLongJson(128, value_type)[0]]: for input_json in [self.genLongJson(128, value_type)[0]]:
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None) self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None)
for input_json in [self.genLongJson(129, value_type)[0]]: for input_json in [self.genLongJson(129, value_type)[0]]:
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
try: try:
self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None) self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None)
except SchemalessError as err: except SchemalessError as err:
@ -625,7 +625,7 @@ class TDTestCase:
mix "`~!@#$¥%^&*()-+={}|[]、「」【】\:;《》<>?" mix "`~!@#$¥%^&*()-+={}|[]、「」【】\:;《》<>?"
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
rstr = list("`~!@#$¥%^&*()-+={}|[]、「」【】\:;《》<>?") rstr = list("`~!@#$¥%^&*()-+={}|[]、「」【】\:;《》<>?")
for i in rstr: for i in rstr:
input_json = self.genFullTypeJson(tb_name=f'aa{i}bb', value_type=value_type)[0] input_json = self.genFullTypeJson(tb_name=f'aa{i}bb', value_type=value_type)[0]
@ -639,7 +639,7 @@ class TDTestCase:
id is start with num id is start with num
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_json = self.genFullTypeJson(tb_name="1aaabbb", value_type=value_type)[0] input_json = self.genFullTypeJson(tb_name="1aaabbb", value_type=value_type)[0]
try: try:
self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None) self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None)
@ -651,7 +651,7 @@ class TDTestCase:
check now unsupported check now unsupported
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_json = self.genFullTypeJson(ts_value=self.genTsColValue(value="now", t_type="ns", value_type=value_type))[0] input_json = self.genFullTypeJson(ts_value=self.genTsColValue(value="now", t_type="ns", value_type=value_type))[0]
try: try:
self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None) self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None)
@ -663,7 +663,7 @@ class TDTestCase:
check date format ts unsupported check date format ts unsupported
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_json = self.genFullTypeJson(ts_value=self.genTsColValue(value="2021-07-21\ 19:01:46.920", t_type="ns", value_type=value_type))[0] input_json = self.genFullTypeJson(ts_value=self.genTsColValue(value="2021-07-21\ 19:01:46.920", t_type="ns", value_type=value_type))[0]
try: try:
self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None) self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None)
@ -675,7 +675,7 @@ class TDTestCase:
check ts format like 16260068336390us19 check ts format like 16260068336390us19
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_json = self.genFullTypeJson(ts_value=self.genTsColValue(value="16260068336390us19", t_type="us", value_type=value_type))[0] input_json = self.genFullTypeJson(ts_value=self.genTsColValue(value="16260068336390us19", t_type="us", value_type=value_type))[0]
try: try:
self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None) self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None)
@ -690,7 +690,7 @@ class TDTestCase:
length of stb_name tb_name <= 192 length of stb_name tb_name <= 192
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
tdSql.execute('reset query cache') tdSql.execute('reset query cache')
stb_name_192 = tdCom.getLongName(len=192, mode="letters") stb_name_192 = tdCom.getLongName(len=192, mode="letters")
tb_name_192 = tdCom.getLongName(len=192, mode="letters") tb_name_192 = tdCom.getLongName(len=192, mode="letters")
@ -715,7 +715,7 @@ class TDTestCase:
check tag name limit <= 62 check tag name limit <= 62
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
tag_name = tdCom.getLongName(61, "letters") tag_name = tdCom.getLongName(61, "letters")
tag_name = f't{tag_name}' tag_name = f't{tag_name}'
stb_name = tdCom.getLongName(7, "letters") stb_name = tdCom.getLongName(7, "letters")
@ -733,7 +733,7 @@ class TDTestCase:
check full type tag value limit check full type tag value limit
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
# i8 # i8
for t1 in [-127, 127]: for t1 in [-127, 127]:
input_json, stb_name = self.genFullTypeJson(tag_value=self.genTagValue(t1_value=t1, value_type=value_type)) input_json, stb_name = self.genFullTypeJson(tag_value=self.genTagValue(t1_value=t1, value_type=value_type))
@ -854,12 +854,12 @@ class TDTestCase:
check full type col value limit check full type col value limit
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
# i8 # i8
for value in [-128, 127]: for value in [-128, 127]:
input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="tinyint", value_type=value_type)) input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="tinyint", value_type=value_type))
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
for value in [-129, 128]: for value in [-129, 128]:
input_json = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="tinyint"))[0] input_json = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="tinyint"))[0]
try: try:
@ -868,11 +868,11 @@ class TDTestCase:
except SchemalessError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# i16 # i16
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
for value in [-32768]: for value in [-32768]:
input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="smallint", value_type=value_type)) input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="smallint", value_type=value_type))
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
for value in [-32769, 32768]: for value in [-32769, 32768]:
input_json = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="smallint"))[0] input_json = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="smallint"))[0]
try: try:
@ -882,11 +882,11 @@ class TDTestCase:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# i32 # i32
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
for value in [-2147483648]: for value in [-2147483648]:
input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="int", value_type=value_type)) input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="int", value_type=value_type))
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
for value in [-2147483649, 2147483648]: for value in [-2147483649, 2147483648]:
input_json = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="int"))[0] input_json = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="int"))[0]
try: try:
@ -896,12 +896,12 @@ class TDTestCase:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# i64 # i64
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
for value in [-9223372036854775808]: for value in [-9223372036854775808]:
input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="bigint", value_type=value_type)) input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="bigint", value_type=value_type))
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
# ! bug # ! bug
# tdCom.cleanTb() # tdCom.cleanTb(dbname="test")
# for value in [-9223372036854775809, 9223372036854775808]: # for value in [-9223372036854775809, 9223372036854775808]:
# print(value) # print(value)
# input_json = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="bigint"))[0] # input_json = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="bigint"))[0]
@ -913,12 +913,12 @@ class TDTestCase:
# tdSql.checkNotEqual(err.errno, 0) # tdSql.checkNotEqual(err.errno, 0)
# f32 # f32
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
for value in [-3.4028234663852885981170418348451692544*(10**38), 3.4028234663852885981170418348451692544*(10**38)]: for value in [-3.4028234663852885981170418348451692544*(10**38), 3.4028234663852885981170418348451692544*(10**38)]:
input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="float", value_type=value_type)) input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="float", value_type=value_type))
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
# * limit set to 4028234664*(10**38) # * limit set to 4028234664*(10**38)
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
for value in [-3.4028234664*(10**38), 3.4028234664*(10**38)]: for value in [-3.4028234664*(10**38), 3.4028234664*(10**38)]:
input_json = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="float"))[0] input_json = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="float"))[0]
try: try:
@ -928,12 +928,12 @@ class TDTestCase:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# f64 # f64
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
for value in [-1.79769313486231570814527423731704356798070567525844996598917476803157260780*(10**308), -1.79769313486231570814527423731704356798070567525844996598917476803157260780*(10**308)]: for value in [-1.79769313486231570814527423731704356798070567525844996598917476803157260780*(10**308), -1.79769313486231570814527423731704356798070567525844996598917476803157260780*(10**308)]:
input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="double", value_type=value_type)) input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="double", value_type=value_type))
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
# * limit set to 1.797693134862316*(10**308) # * limit set to 1.797693134862316*(10**308)
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
for value in [-1.797693134862316*(10**308), -1.797693134862316*(10**308)]: for value in [-1.797693134862316*(10**308), -1.797693134862316*(10**308)]:
input_json = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="double", value_type=value_type))[0] input_json = self.genFullTypeJson(col_value=self.genTsColValue(value=value, t_type="double", value_type=value_type))[0]
try: try:
@ -944,12 +944,12 @@ class TDTestCase:
# if value_type == "obj": # if value_type == "obj":
# # binary # # binary
# tdCom.cleanTb() # tdCom.cleanTb(dbname="test")
# stb_name = tdCom.getLongName(7, "letters") # stb_name = tdCom.getLongName(7, "letters")
# input_json = {"metric": stb_name, "timestamp": {'value': 1626006833639000000, 'type': 'ns'}, "value": {'value': tdCom.getLongName(16374, "letters"), 'type': 'binary'}, "tags": {"t0": {'value': True, 'type': 'bool'}}} # input_json = {"metric": stb_name, "timestamp": {'value': 1626006833639000000, 'type': 'ns'}, "value": {'value': tdCom.getLongName(16374, "letters"), 'type': 'binary'}, "tags": {"t0": {'value': True, 'type': 'bool'}}}
# self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None) # self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None)
# tdCom.cleanTb() # tdCom.cleanTb(dbname="test")
# input_json = {"metric": stb_name, "timestamp": {'value': 1626006833639000000, 'type': 'ns'}, "value": {'value': tdCom.getLongName(16375, "letters"), 'type': 'binary'}, "tags": {"t0": {'value': True, 'type': 'bool'}}} # input_json = {"metric": stb_name, "timestamp": {'value': 1626006833639000000, 'type': 'ns'}, "value": {'value': tdCom.getLongName(16375, "letters"), 'type': 'binary'}, "tags": {"t0": {'value': True, 'type': 'bool'}}}
# try: # try:
# self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None) # self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None)
@ -959,12 +959,12 @@ class TDTestCase:
# # nchar # # nchar
# # * legal nchar could not be larger than 16374/4 # # * legal nchar could not be larger than 16374/4
# tdCom.cleanTb() # tdCom.cleanTb(dbname="test")
# stb_name = tdCom.getLongName(7, "letters") # stb_name = tdCom.getLongName(7, "letters")
# input_json = {"metric": stb_name, "timestamp": {'value': 1626006833639000000, 'type': 'ns'}, "value": {'value': tdCom.getLongName(4093, "letters"), 'type': 'nchar'}, "tags": {"t0": {'value': True, 'type': 'bool'}}} # input_json = {"metric": stb_name, "timestamp": {'value': 1626006833639000000, 'type': 'ns'}, "value": {'value': tdCom.getLongName(4093, "letters"), 'type': 'nchar'}, "tags": {"t0": {'value': True, 'type': 'bool'}}}
# self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None) # self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None)
# tdCom.cleanTb() # tdCom.cleanTb(dbname="test")
# input_json = {"metric": stb_name, "timestamp": {'value': 1626006833639000000, 'type': 'ns'}, "value": {'value': tdCom.getLongName(4094, "letters"), 'type': 'nchar'}, "tags": {"t0": {'value': True, 'type': 'bool'}}} # input_json = {"metric": stb_name, "timestamp": {'value': 1626006833639000000, 'type': 'ns'}, "value": {'value': tdCom.getLongName(4094, "letters"), 'type': 'nchar'}, "tags": {"t0": {'value': True, 'type': 'bool'}}}
# try: # try:
# self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None) # self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None)
@ -973,14 +973,14 @@ class TDTestCase:
# tdSql.checkNotEqual(err.errno, 0) # tdSql.checkNotEqual(err.errno, 0)
# elif value_type == "default": # elif value_type == "default":
# # binary # # binary
# tdCom.cleanTb() # tdCom.cleanTb(dbname="test")
# stb_name = tdCom.getLongName(7, "letters") # stb_name = tdCom.getLongName(7, "letters")
# if tdSql.getVariable("defaultJSONStrType")[0].lower() == "binary": # if tdSql.getVariable("defaultJSONStrType")[0].lower() == "binary":
# input_json = {"metric": stb_name, "timestamp": 1626006834, "value": tdCom.getLongName(16374, "letters"), "tags": {"t0": {'value': True, 'type': 'bool'}}} # input_json = {"metric": stb_name, "timestamp": 1626006834, "value": tdCom.getLongName(16374, "letters"), "tags": {"t0": {'value': True, 'type': 'bool'}}}
# elif tdSql.getVariable("defaultJSONStrType")[0].lower() == "nchar": # elif tdSql.getVariable("defaultJSONStrType")[0].lower() == "nchar":
# input_json = {"metric": stb_name, "timestamp": 1626006834, "value": tdCom.getLongName(4093, "letters"), "tags": {"t0": {'value': True, 'type': 'bool'}}} # input_json = {"metric": stb_name, "timestamp": 1626006834, "value": tdCom.getLongName(4093, "letters"), "tags": {"t0": {'value': True, 'type': 'bool'}}}
# self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None) # self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None)
# tdCom.cleanTb() # tdCom.cleanTb(dbname="test")
# if tdSql.getVariable("defaultJSONStrType")[0].lower() == "binary": # if tdSql.getVariable("defaultJSONStrType")[0].lower() == "binary":
# input_json = {"metric": stb_name, "timestamp": 1626006834, "value": tdCom.getLongName(16375, "letters"), "tags": {"t0": {'value': True, 'type': 'bool'}}} # input_json = {"metric": stb_name, "timestamp": 1626006834, "value": tdCom.getLongName(16375, "letters"), "tags": {"t0": {'value': True, 'type': 'bool'}}}
# elif tdSql.getVariable("defaultJSONStrType")[0].lower() == "nchar": # elif tdSql.getVariable("defaultJSONStrType")[0].lower() == "nchar":
@ -997,7 +997,7 @@ class TDTestCase:
test illegal tag col value test illegal tag col value
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
# bool # bool
for i in ["TrUe", "tRue", "trUe", "truE", "FalsE", "fAlse", "faLse", "falSe", "falsE"]: for i in ["TrUe", "tRue", "trUe", "truE", "FalsE", "fAlse", "faLse", "falSe", "falsE"]:
try: try:
@ -1046,7 +1046,7 @@ class TDTestCase:
check duplicate Id Tag Col check duplicate Id Tag Col
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_json = self.genFullTypeJson(id_double_tag=True, value_type=value_type)[0] input_json = self.genFullTypeJson(id_double_tag=True, value_type=value_type)[0]
print(input_json) print(input_json)
try: try:
@ -1068,7 +1068,7 @@ class TDTestCase:
case no id when stb exist case no id when stb exist
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_json, stb_name = self.genFullTypeJson(tb_name="sub_table_0123456", col_value=self.genTsColValue(value=True, t_type="bool", value_type=value_type), tag_value=self.genTagValue(t0_value=True, value_type=value_type)) input_json, stb_name = self.genFullTypeJson(tb_name="sub_table_0123456", col_value=self.genTsColValue(value=True, t_type="bool", value_type=value_type), tag_value=self.genTagValue(t0_value=True, value_type=value_type))
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
input_json, stb_name = self.genFullTypeJson(stb_name=stb_name, id_noexist_tag=True, col_value=self.genTsColValue(value=True, t_type="bool", value_type=value_type), tag_value=self.genTagValue(t0_value=True, value_type=value_type)) input_json, stb_name = self.genFullTypeJson(stb_name=stb_name, id_noexist_tag=True, col_value=self.genTsColValue(value=True, t_type="bool", value_type=value_type), tag_value=self.genTagValue(t0_value=True, value_type=value_type))
@ -1081,7 +1081,7 @@ class TDTestCase:
check duplicate insert when stb exist check duplicate insert when stb exist
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_json, stb_name = self.genFullTypeJson(value_type=value_type) input_json, stb_name = self.genFullTypeJson(value_type=value_type)
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None) self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None)
@ -1091,7 +1091,7 @@ class TDTestCase:
""" """
check length increase check length increase
""" """
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_json, stb_name = self.genFullTypeJson(value_type=value_type) input_json, stb_name = self.genFullTypeJson(value_type=value_type)
self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None) self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None)
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
@ -1105,7 +1105,7 @@ class TDTestCase:
check length increase check length increase
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
stb_name = "test_crash" stb_name = "test_crash"
input_json = self.genFullTypeJson(stb_name=stb_name)[0] input_json = self.genFullTypeJson(stb_name=stb_name)[0]
self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None) self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None)
@ -1128,7 +1128,7 @@ class TDTestCase:
* col is added with value when update==1 * col is added with value when update==1
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
tb_name = tdCom.getLongName(7, "letters") tb_name = tdCom.getLongName(7, "letters")
for db_update_tag in [0, 1]: for db_update_tag in [0, 1]:
if db_update_tag == 1 : if db_update_tag == 1 :
@ -1154,7 +1154,7 @@ class TDTestCase:
check tag count add check tag count add
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
tb_name = tdCom.getLongName(7, "letters") tb_name = tdCom.getLongName(7, "letters")
input_json, stb_name = self.genFullTypeJson(tb_name=tb_name, col_value=self.genTsColValue(value=True, t_type="bool", value_type=value_type), tag_value=self.genTagValue(t0_value=True, value_type=value_type)) input_json, stb_name = self.genFullTypeJson(tb_name=tb_name, col_value=self.genTsColValue(value=True, t_type="bool", value_type=value_type), tag_value=self.genTagValue(t0_value=True, value_type=value_type))
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
@ -1171,7 +1171,7 @@ class TDTestCase:
insert two table, keep tag unchange, change col insert two table, keep tag unchange, change col
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value=True, t_type="bool", value_type=value_type), tag_value=self.genTagValue(t0_value=True, value_type=value_type), id_noexist_tag=True) input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value=True, t_type="bool", value_type=value_type), tag_value=self.genTagValue(t0_value=True, value_type=value_type), id_noexist_tag=True)
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
tb_name1 = self.getNoIdTbName(stb_name) tb_name1 = self.getNoIdTbName(stb_name)
@ -1194,7 +1194,7 @@ class TDTestCase:
every binary and nchar must be length+2 every binary and nchar must be length+2
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
stb_name = tdCom.getLongName(7, "letters") stb_name = tdCom.getLongName(7, "letters")
tb_name = f'{stb_name}_1' tb_name = f'{stb_name}_1'
tag_value = {"t0": {"value": True, "type": "bool"}} tag_value = {"t0": {"value": True, "type": "bool"}}
@ -1240,7 +1240,7 @@ class TDTestCase:
check nchar length limit check nchar length limit
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
stb_name = tdCom.getLongName(7, "letters") stb_name = tdCom.getLongName(7, "letters")
tb_name = f'{stb_name}_1' tb_name = f'{stb_name}_1'
tag_value = {"t0": True} tag_value = {"t0": True}
@ -1284,7 +1284,7 @@ class TDTestCase:
test batch insert test batch insert
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
stb_name = "stb_name" stb_name = "stb_name"
tdSql.execute(f'create stable {stb_name}(ts timestamp, f int) tags(t1 bigint)') tdSql.execute(f'create stable {stb_name}(ts timestamp, f int) tags(t1 bigint)')
input_json = [{"metric": "st123456", "timestamp": {"value": 1626006833639000000, "type": "ns"}, "value": {"value": 1, "type": "bigint"}, "tags": {"t1": {"value": 3, "type": "bigint"}, "t2": {"value": 4, "type": "double"}, "t3": {"value": "t3", "type": "binary"}}}, input_json = [{"metric": "st123456", "timestamp": {"value": 1626006833639000000, "type": "ns"}, "value": {"value": 1, "type": "bigint"}, "tags": {"t1": {"value": 3, "type": "bigint"}, "t2": {"value": 4, "type": "double"}, "t3": {"value": "t3", "type": "binary"}}},
@ -1319,7 +1319,7 @@ class TDTestCase:
test multi insert test multi insert
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
sql_list = list() sql_list = list()
stb_name = tdCom.getLongName(8, "letters") stb_name = tdCom.getLongName(8, "letters")
tdSql.execute(f'create stable {stb_name}(ts timestamp, f int) tags(t1 bigint)') tdSql.execute(f'create stable {stb_name}(ts timestamp, f int) tags(t1 bigint)')
@ -1335,7 +1335,7 @@ class TDTestCase:
test batch error insert test batch error insert
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_json = [{"metric": "st123456", "timestamp": {"value": 1626006833639000000, "type": "ns"}, "value": {"value": "tt", "type": "bool"}, "tags": {"t1": {"value": 3, "type": "bigint"}, "t2": {"value": 4, "type": "double"}, "t3": {"value": "t3", "type": "binary"}}}, input_json = [{"metric": "st123456", "timestamp": {"value": 1626006833639000000, "type": "ns"}, "value": {"value": "tt", "type": "bool"}, "tags": {"t1": {"value": 3, "type": "bigint"}, "t2": {"value": 4, "type": "double"}, "t3": {"value": "t3", "type": "binary"}}},
{"metric": "st123456", "timestamp": {"value": 1626006933641000000, "type": "ns"}, "value": {"value": 9, "type": "bigint"}, "tags": {"t1": {"value": 4, "type": "bigint"}, "t3": {"value": "t4", "type": "binary"}, "t2": {"value": 5, "type": "double"}, "t4": {"value": 5, "type": "double"}}}] {"metric": "st123456", "timestamp": {"value": 1626006933641000000, "type": "ns"}, "value": {"value": 9, "type": "bigint"}, "tags": {"t1": {"value": 4, "type": "bigint"}, "t3": {"value": "t4", "type": "binary"}, "t2": {"value": 5, "type": "double"}, "t4": {"value": 5, "type": "double"}}}]
try: try:
@ -1349,7 +1349,7 @@ class TDTestCase:
test multi cols insert test multi cols insert
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_json = self.genFullTypeJson(c_multi_tag=True, value_type=value_type)[0] input_json = self.genFullTypeJson(c_multi_tag=True, value_type=value_type)[0]
try: try:
self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None) self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None)
@ -1362,7 +1362,7 @@ class TDTestCase:
test blank col insert test blank col insert
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_json = self.genFullTypeJson(c_blank_tag=True, value_type=value_type)[0] input_json = self.genFullTypeJson(c_blank_tag=True, value_type=value_type)[0]
try: try:
self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None) self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None)
@ -1375,7 +1375,7 @@ class TDTestCase:
test blank tag insert test blank tag insert
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_json = self.genFullTypeJson(t_blank_tag=True, value_type=value_type)[0] input_json = self.genFullTypeJson(t_blank_tag=True, value_type=value_type)[0]
try: try:
self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None) self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None)
@ -1388,7 +1388,7 @@ class TDTestCase:
check nchar ---> chinese check nchar ---> chinese
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_json, stb_name = self.genFullTypeJson(chinese_tag=True) input_json, stb_name = self.genFullTypeJson(chinese_tag=True)
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
@ -1397,7 +1397,7 @@ class TDTestCase:
multi_field multi_field
''' '''
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_json = self.genFullTypeJson(multi_field_tag=True, value_type=value_type)[0] input_json = self.genFullTypeJson(multi_field_tag=True, value_type=value_type)[0]
try: try:
self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None) self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None)
@ -1407,7 +1407,7 @@ class TDTestCase:
def spellCheckCase(self): def spellCheckCase(self):
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
stb_name = tdCom.getLongName(8, "letters") stb_name = tdCom.getLongName(8, "letters")
input_json_list = [{"metric": f'{stb_name}_1', "timestamp": {"value": 1626006833639000000, "type": "Ns"}, "value": {"value": 1, "type": "Bigint"}, "tags": {"t1": {"value": 127, "type": "tinYint"}}}, input_json_list = [{"metric": f'{stb_name}_1', "timestamp": {"value": 1626006833639000000, "type": "Ns"}, "value": {"value": 1, "type": "Bigint"}, "tags": {"t1": {"value": 127, "type": "tinYint"}}},
{"metric": f'{stb_name}_2', "timestamp": {"value": 1626006833639000001, "type": "nS"}, "value": {"value": 32767, "type": "smallInt"}, "tags": {"t1": {"value": 32767, "type": "smallInt"}}}, {"metric": f'{stb_name}_2', "timestamp": {"value": 1626006833639000001, "type": "nS"}, "value": {"value": 32767, "type": "smallInt"}, "tags": {"t1": {"value": 32767, "type": "smallInt"}}},
@ -1426,7 +1426,7 @@ class TDTestCase:
def tbnameTagsColsNameCheckCase(self): def tbnameTagsColsNameCheckCase(self):
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_json = {'metric': 'rFa$sta', 'timestamp': {'value': 1626006834, 'type': 's'}, 'value': {'value': True, 'type': 'bool'}, 'tags': {'Tt!0': {'value': False, 'type': 'bool'}, 'tT@1': {'value': 127, 'type': 'tinyint'}, 't@2': {'value': 32767, 'type': 'smallint'}, 't$3': {'value': 2147483647, 'type': 'int'}, 't%4': {'value': 9223372036854775807, 'type': 'bigint'}, 't^5': {'value': 11.12345027923584, 'type': 'float'}, 't&6': {'value': 22.123456789, 'type': 'double'}, 't*7': {'value': 'binaryTagValue', 'type': 'binary'}, 't!@#$%^&*()_+[];:<>?,9': {'value': 'ncharTagValue', 'type': 'nchar'}, 'id': 'rFas$ta_1'}} input_json = {'metric': 'rFa$sta', 'timestamp': {'value': 1626006834, 'type': 's'}, 'value': {'value': True, 'type': 'bool'}, 'tags': {'Tt!0': {'value': False, 'type': 'bool'}, 'tT@1': {'value': 127, 'type': 'tinyint'}, 't@2': {'value': 32767, 'type': 'smallint'}, 't$3': {'value': 2147483647, 'type': 'int'}, 't%4': {'value': 9223372036854775807, 'type': 'bigint'}, 't^5': {'value': 11.12345027923584, 'type': 'float'}, 't&6': {'value': 22.123456789, 'type': 'double'}, 't*7': {'value': 'binaryTagValue', 'type': 'binary'}, 't!@#$%^&*()_+[];:<>?,9': {'value': 'ncharTagValue', 'type': 'nchar'}, 'id': 'rFas$ta_1'}}
self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None) self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None)
query_sql = 'select * from `rFa$sta`' query_sql = 'select * from `rFa$sta`'
@ -1441,7 +1441,7 @@ class TDTestCase:
metric value "." trans to "_" metric value "." trans to "_"
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_json = self.genFullTypeJson(point_trans_tag=True, value_type=value_type)[0] input_json = self.genFullTypeJson(point_trans_tag=True, value_type=value_type)[0]
self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None) self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None)
tdSql.execute("drop table `.point.trans.test`") tdSql.execute("drop table `.point.trans.test`")
@ -1509,7 +1509,7 @@ class TDTestCase:
thread input different stb thread input different stb
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_json = self.genSqlList(value_type=value_type)[0] input_json = self.genSqlList(value_type=value_type)[0]
self.multiThreadRun(self.genMultiThreadSeq(input_json)) self.multiThreadRun(self.genMultiThreadSeq(input_json))
tdSql.query(f"show tables;") tdSql.query(f"show tables;")
@ -1520,7 +1520,7 @@ class TDTestCase:
thread input same stb tb, different data, result keep first data thread input same stb tb, different data, result keep first data
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
tb_name = tdCom.getLongName(7, "letters") tb_name = tdCom.getLongName(7, "letters")
input_json, stb_name = self.genFullTypeJson(tb_name=tb_name, col_value=self.genTsColValue(value="binaryTagValue", t_type="binary", value_type=value_type)) input_json, stb_name = self.genFullTypeJson(tb_name=tb_name, col_value=self.genTsColValue(value="binaryTagValue", t_type="binary", value_type=value_type))
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
@ -1538,7 +1538,7 @@ class TDTestCase:
thread input same stb tb, different data, add columes and tags, result keep first data thread input same stb tb, different data, add columes and tags, result keep first data
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
tb_name = tdCom.getLongName(7, "letters") tb_name = tdCom.getLongName(7, "letters")
input_json, stb_name = self.genFullTypeJson(tb_name=tb_name, col_value=self.genTsColValue(value="binaryTagValue", t_type="binary", value_type=value_type)) input_json, stb_name = self.genFullTypeJson(tb_name=tb_name, col_value=self.genTsColValue(value="binaryTagValue", t_type="binary", value_type=value_type))
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
@ -1556,7 +1556,7 @@ class TDTestCase:
thread input same stb tb, different data, minus columes and tags, result keep first data thread input same stb tb, different data, minus columes and tags, result keep first data
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
tb_name = tdCom.getLongName(7, "letters") tb_name = tdCom.getLongName(7, "letters")
input_json, stb_name = self.genFullTypeJson(tb_name=tb_name, col_value=self.genTsColValue(value="binaryTagValue", t_type="binary", value_type=value_type)) input_json, stb_name = self.genFullTypeJson(tb_name=tb_name, col_value=self.genTsColValue(value="binaryTagValue", t_type="binary", value_type=value_type))
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
@ -1574,7 +1574,7 @@ class TDTestCase:
thread input same stb, different tb, different data thread input same stb, different tb, different data
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value="binaryTagValue", t_type="binary", value_type=value_type)) input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value="binaryTagValue", t_type="binary", value_type=value_type))
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
s_stb_d_tb_list = self.genSqlList(stb_name=stb_name, value_type=value_type)[4] s_stb_d_tb_list = self.genSqlList(stb_name=stb_name, value_type=value_type)[4]
@ -1587,7 +1587,7 @@ class TDTestCase:
thread input same stb, different tb, different data, add col, mul tag thread input same stb, different tb, different data, add col, mul tag
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value="binaryTagValue", t_type="binary")) input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value="binaryTagValue", t_type="binary"))
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
s_stb_d_tb_m_tag_list = [({"metric": stb_name, "timestamp": {"value": 1626006833639000000, "type": "ns"}, "value": "omfdhyom", "tags": {"t0": {"value": False, "type": "bool"}, "t1": {"value": 127, "type": "tinyint"}, "t2": {"value": 32767, "type": "smallint"}, "t3": {"value": 2147483647, "type": "int"}, "t4": {"value": 9223372036854775807, "type": "bigint"}, "t5": {"value": 11.12345, "type": "float"}, "t6": {"value": 22.123456789, "type": "double"}}}, 'yzwswz'), s_stb_d_tb_m_tag_list = [({"metric": stb_name, "timestamp": {"value": 1626006833639000000, "type": "ns"}, "value": "omfdhyom", "tags": {"t0": {"value": False, "type": "bool"}, "t1": {"value": 127, "type": "tinyint"}, "t2": {"value": 32767, "type": "smallint"}, "t3": {"value": 2147483647, "type": "int"}, "t4": {"value": 9223372036854775807, "type": "bigint"}, "t5": {"value": 11.12345, "type": "float"}, "t6": {"value": 22.123456789, "type": "double"}}}, 'yzwswz'),
@ -1605,7 +1605,7 @@ class TDTestCase:
thread input same stb, different tb, different data, add tag, mul col thread input same stb, different tb, different data, add tag, mul col
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value="binaryTagValue", t_type="binary", value_type=value_type)) input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value="binaryTagValue", t_type="binary", value_type=value_type))
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
s_stb_d_tb_a_tag_list = self.genSqlList(stb_name=stb_name, value_type=value_type)[6] s_stb_d_tb_a_tag_list = self.genSqlList(stb_name=stb_name, value_type=value_type)[6]
@ -1618,7 +1618,7 @@ class TDTestCase:
thread input same stb tb, different ts thread input same stb tb, different ts
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
tb_name = tdCom.getLongName(7, "letters") tb_name = tdCom.getLongName(7, "letters")
input_json, stb_name = self.genFullTypeJson(tb_name=tb_name, col_value=self.genTsColValue(value="binaryTagValue", t_type="binary")) input_json, stb_name = self.genFullTypeJson(tb_name=tb_name, col_value=self.genTsColValue(value="binaryTagValue", t_type="binary"))
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
@ -1638,7 +1638,7 @@ class TDTestCase:
thread input same stb tb, different ts, add col, mul tag thread input same stb tb, different ts, add col, mul tag
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
tb_name = tdCom.getLongName(7, "letters") tb_name = tdCom.getLongName(7, "letters")
input_json, stb_name = self.genFullTypeJson(tb_name=tb_name, col_value=self.genTsColValue(value="binaryTagValue", t_type="binary")) input_json, stb_name = self.genFullTypeJson(tb_name=tb_name, col_value=self.genTsColValue(value="binaryTagValue", t_type="binary"))
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
@ -1660,7 +1660,7 @@ class TDTestCase:
thread input same stb tb, different ts, add tag, mul col thread input same stb tb, different ts, add tag, mul col
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
tb_name = tdCom.getLongName(7, "letters") tb_name = tdCom.getLongName(7, "letters")
input_json, stb_name = self.genFullTypeJson(tb_name=tb_name, col_value=self.genTsColValue(value="binaryTagValue", t_type="binary")) input_json, stb_name = self.genFullTypeJson(tb_name=tb_name, col_value=self.genTsColValue(value="binaryTagValue", t_type="binary"))
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
@ -1683,7 +1683,7 @@ class TDTestCase:
thread input same stb, different tb, data, ts thread input same stb, different tb, data, ts
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value="binaryTagValue", t_type="binary", value_type=value_type)) input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value="binaryTagValue", t_type="binary", value_type=value_type))
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
s_stb_d_tb_d_ts_list = self.genSqlList(stb_name=stb_name, value_type=value_type)[10] s_stb_d_tb_d_ts_list = self.genSqlList(stb_name=stb_name, value_type=value_type)[10]
@ -1696,7 +1696,7 @@ class TDTestCase:
thread input same stb, different tb, data, ts, add col, mul tag thread input same stb, different tb, data, ts, add col, mul tag
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value="binaryTagValue", t_type="binary")) input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value="binaryTagValue", t_type="binary"))
self.resCmp(input_json, stb_name) self.resCmp(input_json, stb_name)
s_stb_d_tb_d_ts_m_tag_list = [({'metric': stb_name, 'timestamp': {'value': 0, 'type': 'ns'}, 'value': 'pjndapjb', 'tags': {'t0': {'value': False, 'type': 'bool'}, 't1': {'value': 127, 'type': 'tinyint'}, 't2': {'value': 32767, 'type': 'smallint'}, 't3': {'value': 2147483647, 'type': 'int'}, 't4': {"value": 9223372036854775807, "type": "bigint"}, 't5': {'value': 11.12345027923584, 'type': 'float'}, 't6': {'value': 22.123456789, 'type': 'double'}}}, 'punftb'), s_stb_d_tb_d_ts_m_tag_list = [({'metric': stb_name, 'timestamp': {'value': 0, 'type': 'ns'}, 'value': 'pjndapjb', 'tags': {'t0': {'value': False, 'type': 'bool'}, 't1': {'value': 127, 'type': 'tinyint'}, 't2': {'value': 32767, 'type': 'smallint'}, 't3': {'value': 2147483647, 'type': 'int'}, 't4': {"value": 9223372036854775807, "type": "bigint"}, 't5': {'value': 11.12345027923584, 'type': 'float'}, 't6': {'value': 22.123456789, 'type': 'double'}}}, 'punftb'),

View File

@ -30,7 +30,7 @@ if platform.system().lower() == 'windows':
class TDTestCase: class TDTestCase:
def init(self, conn, logSql): def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__) tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql) tdSql.init(conn.cursor(), False)
self._conn = conn self._conn = conn
self.smlChildTableName_value = "id" self.smlChildTableName_value = "id"
@ -351,7 +351,7 @@ class TDTestCase:
normal tags and cols, one for every elm normal tags and cols, one for every elm
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql(protocol=protocol) input_sql, stb_name = self.genFullTypeSql(protocol=protocol)
self.resCmp(input_sql, stb_name, protocol=protocol) self.resCmp(input_sql, stb_name, protocol=protocol)
@ -360,7 +360,7 @@ class TDTestCase:
check all normal type check all normal type
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
full_type_list = ["f", "F", "false", "False", "t", "T", "true", "True"] full_type_list = ["f", "F", "false", "False", "t", "T", "true", "True"]
for t_type in full_type_list: for t_type in full_type_list:
input_sql, stb_name = self.genFullTypeSql(t0=t_type, protocol=protocol) input_sql, stb_name = self.genFullTypeSql(t0=t_type, protocol=protocol)
@ -375,7 +375,7 @@ class TDTestCase:
binary_symbols = '\"abcd`~!@#$%^&*()_-{[}]|:;<.>?lfjal"\'\'"\"' binary_symbols = '\"abcd`~!@#$%^&*()_-{[}]|:;<.>?lfjal"\'\'"\"'
''' '''
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
binary_symbols = '"abcd`~!@#$%^&*()_-{[}]|:;<.>?lfjal"' binary_symbols = '"abcd`~!@#$%^&*()_-{[}]|:;<.>?lfjal"'
nchar_symbols = f'L{binary_symbols}' nchar_symbols = f'L{binary_symbols}'
input_sql1, stb_name1 = self.genFullTypeSql(value=binary_symbols, t7=binary_symbols, t8=nchar_symbols, protocol=protocol) input_sql1, stb_name1 = self.genFullTypeSql(value=binary_symbols, t7=binary_symbols, t8=nchar_symbols, protocol=protocol)
@ -388,7 +388,7 @@ class TDTestCase:
test ts list --> ["1626006833640ms", "1626006834s", "1626006822639022"] test ts list --> ["1626006833640ms", "1626006834s", "1626006822639022"]
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql(ts=1626006833640) input_sql, stb_name = self.genFullTypeSql(ts=1626006833640)
self.resCmp(input_sql, stb_name, ts_type=TDSmlTimestampType.MILLI_SECOND.value) self.resCmp(input_sql, stb_name, ts_type=TDSmlTimestampType.MILLI_SECOND.value)
input_sql, stb_name = self.genFullTypeSql(ts=1626006833640) input_sql, stb_name = self.genFullTypeSql(ts=1626006833640)
@ -407,7 +407,7 @@ class TDTestCase:
def openTstbTelnetTsCheckCase(self): def openTstbTelnetTsCheckCase(self):
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql = f'{tdCom.getLongName(len=10, mode="letters")} 0 127 t0=127 t1=32767I16 t2=2147483647I32 t3=9223372036854775807 t4=11.12345027923584F32 t5=22.123456789F64' input_sql = f'{tdCom.getLongName(len=10, mode="letters")} 0 127 t0=127 t1=32767I16 t2=2147483647I32 t3=9223372036854775807 t4=11.12345027923584F32 t5=22.123456789F64'
stb_name = input_sql.split(" ")[0] stb_name = input_sql.split(" ")[0]
self.resCmp(input_sql, stb_name, ts=0) self.resCmp(input_sql, stb_name, ts=0)
@ -431,7 +431,7 @@ class TDTestCase:
eg: t0=**,id=**,t1=** eg: t0=**,id=**,t1=**
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql(id_change_tag=True, protocol=protocol) input_sql, stb_name = self.genFullTypeSql(id_change_tag=True, protocol=protocol)
self.resCmp(input_sql, stb_name, protocol=protocol) self.resCmp(input_sql, stb_name, protocol=protocol)
@ -441,7 +441,7 @@ class TDTestCase:
eg: id and ID eg: id and ID
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql(id_upper_tag=True, protocol=protocol) input_sql, stb_name = self.genFullTypeSql(id_upper_tag=True, protocol=protocol)
self.resCmp(input_sql, stb_name, protocol=protocol) self.resCmp(input_sql, stb_name, protocol=protocol)
input_sql, stb_name = self.genFullTypeSql(id_mixul_tag=True, protocol=protocol) input_sql, stb_name = self.genFullTypeSql(id_mixul_tag=True, protocol=protocol)
@ -454,7 +454,7 @@ class TDTestCase:
id not exist id not exist
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql(id_noexist_tag=True, protocol=protocol) input_sql, stb_name = self.genFullTypeSql(id_noexist_tag=True, protocol=protocol)
self.resCmp(input_sql, stb_name, protocol=protocol) self.resCmp(input_sql, stb_name, protocol=protocol)
query_sql = f"select tbname from {stb_name}" query_sql = f"select tbname from {stb_name}"
@ -470,10 +470,10 @@ class TDTestCase:
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
for input_sql in [self.genLongSql(128)[0]]: for input_sql in [self.genLongSql(128)[0]]:
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None) self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
for input_sql in [self.genLongSql(129)[0]]: for input_sql in [self.genLongSql(129)[0]]:
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
try: try:
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None) self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
raise Exception("should not reach here") raise Exception("should not reach here")
@ -486,7 +486,7 @@ class TDTestCase:
mix "`~!@#$¥%^&*()-+{}|[]、「」【】:;《》<>?" mix "`~!@#$¥%^&*()-+{}|[]、「」【】:;《》<>?"
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
rstr = list("~!@#$¥%^&*()-+{}|[]、「」【】:;《》<>?") rstr = list("~!@#$¥%^&*()-+{}|[]、「」【】:;《》<>?")
for i in rstr: for i in rstr:
input_sql, stb_name = self.genFullTypeSql(tb_name=f"\"aaa{i}bbb\"", protocol=protocol) input_sql, stb_name = self.genFullTypeSql(tb_name=f"\"aaa{i}bbb\"", protocol=protocol)
@ -498,7 +498,7 @@ class TDTestCase:
id is start with num id is start with num
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql(tb_name="1aaabbb", protocol=protocol) input_sql, stb_name = self.genFullTypeSql(tb_name="1aaabbb", protocol=protocol)
self.resCmp(input_sql, stb_name, protocol=protocol) self.resCmp(input_sql, stb_name, protocol=protocol)
@ -507,7 +507,7 @@ class TDTestCase:
check now unsupported check now unsupported
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql = self.genFullTypeSql(ts="now")[0] input_sql = self.genFullTypeSql(ts="now")[0]
try: try:
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None) self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
@ -520,7 +520,7 @@ class TDTestCase:
check date format ts unsupported check date format ts unsupported
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql = self.genFullTypeSql(ts="2021-07-21\ 19:01:46.920")[0] input_sql = self.genFullTypeSql(ts="2021-07-21\ 19:01:46.920")[0]
try: try:
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None) self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
@ -533,7 +533,7 @@ class TDTestCase:
check ts format like 16260068336390us19 check ts format like 16260068336390us19
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql = self.genFullTypeSql(ts="16260068336390us19")[0] input_sql = self.genFullTypeSql(ts="16260068336390us19")[0]
try: try:
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None) self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
@ -551,7 +551,7 @@ class TDTestCase:
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
stb_name_192 = tdCom.getLongName(len=192, mode="letters") stb_name_192 = tdCom.getLongName(len=192, mode="letters")
tb_name_192 = tdCom.getLongName(len=192, mode="letters") tb_name_192 = tdCom.getLongName(len=192, mode="letters")
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name_192, tb_name=tb_name_192) input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name_192, tb_name=tb_name_192)
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
tdSql.query(f'select * from {stb_name}') tdSql.query(f'select * from {stb_name}')
@ -581,7 +581,7 @@ class TDTestCase:
check tag name limit <= 62 check tag name limit <= 62
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
tag_name = tdCom.getLongName(61, "letters") tag_name = tdCom.getLongName(61, "letters")
tag_name = f'T{tag_name}' tag_name = f'T{tag_name}'
stb_name = tdCom.getLongName(7, "letters") stb_name = tdCom.getLongName(7, "letters")
@ -599,7 +599,7 @@ class TDTestCase:
check full type tag value limit check full type tag value limit
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
# nchar # nchar
# * legal nchar could not be larger than 16374/4 # * legal nchar could not be larger than 16374/4
stb_name = tdCom.getLongName(7, "letters") stb_name = tdCom.getLongName(7, "letters")
@ -618,12 +618,12 @@ class TDTestCase:
check full type col value limit check full type col value limit
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
# i8 # i8
for value in ["-128i8", "127i8"]: for value in ["-128i8", "127i8"]:
input_sql, stb_name = self.genFullTypeSql(value=value) input_sql, stb_name = self.genFullTypeSql(value=value)
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
for value in ["-129i8", "128i8"]: for value in ["-129i8", "128i8"]:
input_sql = self.genFullTypeSql(value=value)[0] input_sql = self.genFullTypeSql(value=value)[0]
try: try:
@ -632,11 +632,11 @@ class TDTestCase:
except SchemalessError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# i16 # i16
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
for value in ["-32768i16"]: for value in ["-32768i16"]:
input_sql, stb_name = self.genFullTypeSql(value=value) input_sql, stb_name = self.genFullTypeSql(value=value)
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
for value in ["-32769i16", "32768i16"]: for value in ["-32769i16", "32768i16"]:
input_sql = self.genFullTypeSql(value=value)[0] input_sql = self.genFullTypeSql(value=value)[0]
try: try:
@ -646,11 +646,11 @@ class TDTestCase:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# i32 # i32
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
for value in ["-2147483648i32"]: for value in ["-2147483648i32"]:
input_sql, stb_name = self.genFullTypeSql(value=value) input_sql, stb_name = self.genFullTypeSql(value=value)
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
for value in ["-2147483649i32", "2147483648i32"]: for value in ["-2147483649i32", "2147483648i32"]:
input_sql = self.genFullTypeSql(value=value)[0] input_sql = self.genFullTypeSql(value=value)[0]
try: try:
@ -660,11 +660,11 @@ class TDTestCase:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# i64 # i64
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
for value in ["-9223372036854775808i64"]: for value in ["-9223372036854775808i64"]:
input_sql, stb_name = self.genFullTypeSql(value=value) input_sql, stb_name = self.genFullTypeSql(value=value)
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
for value in ["-9223372036854775809i64", "9223372036854775808i64"]: for value in ["-9223372036854775809i64", "9223372036854775808i64"]:
input_sql = self.genFullTypeSql(value=value)[0] input_sql = self.genFullTypeSql(value=value)[0]
try: try:
@ -674,12 +674,12 @@ class TDTestCase:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# f32 # f32
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
for value in [f"{-3.4028234663852885981170418348451692544*(10**38)}f32", f"{3.4028234663852885981170418348451692544*(10**38)}f32"]: for value in [f"{-3.4028234663852885981170418348451692544*(10**38)}f32", f"{3.4028234663852885981170418348451692544*(10**38)}f32"]:
input_sql, stb_name = self.genFullTypeSql(value=value) input_sql, stb_name = self.genFullTypeSql(value=value)
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
# * limit set to 4028234664*(10**38) # * limit set to 4028234664*(10**38)
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
for value in [f"{-3.4028234664*(10**38)}f32", f"{3.4028234664*(10**38)}f32"]: for value in [f"{-3.4028234664*(10**38)}f32", f"{3.4028234664*(10**38)}f32"]:
input_sql = self.genFullTypeSql(value=value)[0] input_sql = self.genFullTypeSql(value=value)[0]
try: try:
@ -689,12 +689,12 @@ class TDTestCase:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# f64 # f64
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
for value in [f'{-1.79769313486231570814527423731704356798070567525844996598917476803157260780*(10**308)}f64', f'{-1.79769313486231570814527423731704356798070567525844996598917476803157260780*(10**308)}f64']: for value in [f'{-1.79769313486231570814527423731704356798070567525844996598917476803157260780*(10**308)}f64', f'{-1.79769313486231570814527423731704356798070567525844996598917476803157260780*(10**308)}f64']:
input_sql, stb_name = self.genFullTypeSql(value=value) input_sql, stb_name = self.genFullTypeSql(value=value)
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
# # * limit set to 1.797693134862316*(10**308) # # * limit set to 1.797693134862316*(10**308)
# tdCom.cleanTb() # tdCom.cleanTb(dbname="test")
# for value in [f'{-1.797693134862316*(10**308)}f64', f'{-1.797693134862316*(10**308)}f64']: # for value in [f'{-1.797693134862316*(10**308)}f64', f'{-1.797693134862316*(10**308)}f64']:
# input_sql = self.genFullTypeSql(value=value)[0] # input_sql = self.genFullTypeSql(value=value)[0]
# try: # try:
@ -704,12 +704,12 @@ class TDTestCase:
# tdSql.checkNotEqual(err.errno, 0) # tdSql.checkNotEqual(err.errno, 0)
# # # binary # # # binary
# tdCom.cleanTb() # tdCom.cleanTb(dbname="test")
# stb_name = tdCom.getLongName(7, "letters") # stb_name = tdCom.getLongName(7, "letters")
# input_sql = f'{stb_name} 1626006833640 "{tdCom.getLongName(16374, "letters")}" t0=t' # input_sql = f'{stb_name} 1626006833640 "{tdCom.getLongName(16374, "letters")}" t0=t'
# self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None) # self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
# tdCom.cleanTb() # tdCom.cleanTb(dbname="test")
# input_sql = f'{stb_name} 1626006833640 "{tdCom.getLongName(16375, "letters")}" t0=t' # input_sql = f'{stb_name} 1626006833640 "{tdCom.getLongName(16375, "letters")}" t0=t'
# try: # try:
# self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None) # self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
@ -719,12 +719,12 @@ class TDTestCase:
# # nchar # # nchar
# # * legal nchar could not be larger than 16374/4 # # * legal nchar could not be larger than 16374/4
# tdCom.cleanTb() # tdCom.cleanTb(dbname="test")
# stb_name = tdCom.getLongName(7, "letters") # stb_name = tdCom.getLongName(7, "letters")
# input_sql = f'{stb_name} 1626006833640 L"{tdCom.getLongName(4093, "letters")}" t0=t' # input_sql = f'{stb_name} 1626006833640 L"{tdCom.getLongName(4093, "letters")}" t0=t'
# self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None) # self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
# tdCom.cleanTb() # tdCom.cleanTb(dbname="test")
# input_sql = f'{stb_name} 1626006833640 L"{tdCom.getLongName(4094, "letters")}" t0=t' # input_sql = f'{stb_name} 1626006833640 L"{tdCom.getLongName(4094, "letters")}" t0=t'
# try: # try:
# self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None) # self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
@ -738,7 +738,7 @@ class TDTestCase:
test illegal tag col value test illegal tag col value
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
# bool # bool
for i in ["TrUe", "tRue", "trUe", "truE", "FalsE", "fAlse", "faLse", "falSe", "falsE"]: for i in ["TrUe", "tRue", "trUe", "truE", "FalsE", "fAlse", "faLse", "falSe", "falsE"]:
input_sql1, stb_name = self.genFullTypeSql(t0=i) input_sql1, stb_name = self.genFullTypeSql(t0=i)
@ -774,7 +774,7 @@ class TDTestCase:
check blank case check blank case
''' '''
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
# input_sql_list = [f'{tdCom.getLongName(7, "letters")} 1626006833640 "abc aaa" t0=t', # input_sql_list = [f'{tdCom.getLongName(7, "letters")} 1626006833640 "abc aaa" t0=t',
# f'{tdCom.getLongName(7, "letters")} 1626006833640 t t0="abaaa"', # f'{tdCom.getLongName(7, "letters")} 1626006833640 t t0="abaaa"',
# f'{tdCom.getLongName(7, "letters")} 1626006833640 t t0=L"abaaa"', # f'{tdCom.getLongName(7, "letters")} 1626006833640 t t0=L"abaaa"',
@ -792,7 +792,7 @@ class TDTestCase:
check duplicate Id Tag Col check duplicate Id Tag Col
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql_id = self.genFullTypeSql(id_double_tag=True)[0] input_sql_id = self.genFullTypeSql(id_double_tag=True)[0]
try: try:
self._conn.schemaless_insert([input_sql_id], TDSmlProtocolType.TELNET.value, None) self._conn.schemaless_insert([input_sql_id], TDSmlProtocolType.TELNET.value, None)
@ -815,7 +815,7 @@ class TDTestCase:
case no id when stb exist case no id when stb exist
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql(tb_name="sub_table_0123456", t0="f", value="f") input_sql, stb_name = self.genFullTypeSql(tb_name="sub_table_0123456", t0="f", value="f")
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, id_noexist_tag=True, t0="f", value="f") input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, id_noexist_tag=True, t0="f", value="f")
@ -828,7 +828,7 @@ class TDTestCase:
check duplicate insert when stb exist check duplicate insert when stb exist
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql() input_sql, stb_name = self.genFullTypeSql()
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None) self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
@ -840,7 +840,7 @@ class TDTestCase:
check length increase check length increase
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql() input_sql, stb_name = self.genFullTypeSql()
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
tb_name = tdCom.getLongName(5, "letters") tb_name = tdCom.getLongName(5, "letters")
@ -858,7 +858,7 @@ class TDTestCase:
* col is added with value when update==1 * col is added with value when update==1
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
tb_name = tdCom.getLongName(7, "letters") tb_name = tdCom.getLongName(7, "letters")
for db_update_tag in [0, 1]: for db_update_tag in [0, 1]:
if db_update_tag == 1 : if db_update_tag == 1 :
@ -885,7 +885,7 @@ class TDTestCase:
check tag count add check tag count add
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
tb_name = tdCom.getLongName(7, "letters") tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, t0="f", value="f") input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, t0="f", value="f")
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
@ -902,7 +902,7 @@ class TDTestCase:
insert two table, keep tag unchange, change col insert two table, keep tag unchange, change col
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql(t0="f", value="f", id_noexist_tag=True) input_sql, stb_name = self.genFullTypeSql(t0="f", value="f", id_noexist_tag=True)
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
tb_name1 = self.getNoIdTbName(stb_name) tb_name1 = self.getNoIdTbName(stb_name)
@ -925,7 +925,7 @@ class TDTestCase:
check nchar length limit check nchar length limit
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
stb_name = tdCom.getLongName(7, "letters") stb_name = tdCom.getLongName(7, "letters")
input_sql = f'{stb_name} 1626006833640 f t2={tdCom.getLongName(1, "letters")}' input_sql = f'{stb_name} 1626006833640 f t2={tdCom.getLongName(1, "letters")}'
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None) self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
@ -949,7 +949,7 @@ class TDTestCase:
test batch insert test batch insert
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
stb_name = tdCom.getLongName(8, "letters") stb_name = tdCom.getLongName(8, "letters")
tdSql.execute(f'create stable {stb_name}(ts timestamp, f int) tags(t1 bigint)') tdSql.execute(f'create stable {stb_name}(ts timestamp, f int) tags(t1 bigint)')
@ -976,7 +976,7 @@ class TDTestCase:
test multi insert test multi insert
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
sql_list = [] sql_list = []
stb_name = tdCom.getLongName(8, "letters") stb_name = tdCom.getLongName(8, "letters")
tdSql.execute(f'create stable {stb_name}(ts timestamp, f int) tags(t1 nchar(10))') tdSql.execute(f'create stable {stb_name}(ts timestamp, f int) tags(t1 nchar(10))')
@ -992,7 +992,7 @@ class TDTestCase:
test batch error insert test batch error insert
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
stb_name = tdCom.getLongName(8, "letters") stb_name = tdCom.getLongName(8, "letters")
lines = ["st123456 1626006833640 3i 64 t1=3i64 t2=4f64 t3=\"t3\"", lines = ["st123456 1626006833640 3i 64 t1=3i64 t2=4f64 t3=\"t3\"",
f"{stb_name} 1626056811823316532ns tRue t2=5f64 t3=L\"ste\""] f"{stb_name} 1626056811823316532ns tRue t2=5f64 t3=L\"ste\""]
@ -1007,7 +1007,7 @@ class TDTestCase:
test multi cols insert test multi cols insert
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql = self.genFullTypeSql(c_multi_tag=True)[0] input_sql = self.genFullTypeSql(c_multi_tag=True)[0]
try: try:
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None) self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
@ -1020,7 +1020,7 @@ class TDTestCase:
test blank col insert test blank col insert
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql = self.genFullTypeSql(c_blank_tag=True)[0] input_sql = self.genFullTypeSql(c_blank_tag=True)[0]
try: try:
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None) self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
@ -1033,7 +1033,7 @@ class TDTestCase:
test blank tag insert test blank tag insert
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql = self.genFullTypeSql(t_blank_tag=True)[0] input_sql = self.genFullTypeSql(t_blank_tag=True)[0]
try: try:
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None) self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
@ -1046,7 +1046,7 @@ class TDTestCase:
check nchar ---> chinese check nchar ---> chinese
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql(chinese_tag=True) input_sql, stb_name = self.genFullTypeSql(chinese_tag=True)
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
@ -1055,7 +1055,7 @@ class TDTestCase:
multi_field multi_field
''' '''
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql = self.genFullTypeSql(multi_field_tag=True)[0] input_sql = self.genFullTypeSql(multi_field_tag=True)[0]
try: try:
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None) self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
@ -1065,7 +1065,7 @@ class TDTestCase:
def spellCheckCase(self): def spellCheckCase(self):
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
stb_name = tdCom.getLongName(8, "letters") stb_name = tdCom.getLongName(8, "letters")
input_sql_list = [f'{stb_name}_1 1626006833640 127I8 t0=127I8 t1=32767I16 t2=2147483647I32 t3=9223372036854775807I64 t4=11.12345027923584F32 t5=22.123456789F64', input_sql_list = [f'{stb_name}_1 1626006833640 127I8 t0=127I8 t1=32767I16 t2=2147483647I32 t3=9223372036854775807I64 t4=11.12345027923584F32 t5=22.123456789F64',
f'{stb_name}_2 1626006833640 32767I16 t0=127I8 t1=32767I16 t2=2147483647I32 t3=9223372036854775807I64 t4=11.12345027923584F32 t5=22.123456789F64', f'{stb_name}_2 1626006833640 32767I16 t0=127I8 t1=32767I16 t2=2147483647I32 t3=9223372036854775807I64 t4=11.12345027923584F32 t5=22.123456789F64',
@ -1086,7 +1086,7 @@ class TDTestCase:
metric value "." trans to "_" metric value "." trans to "_"
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql = self.genFullTypeSql(point_trans_tag=True, protocol=protocol)[0] input_sql = self.genFullTypeSql(point_trans_tag=True, protocol=protocol)[0]
if protocol == 'telnet-tcp': if protocol == 'telnet-tcp':
stb_name = f'`{input_sql.split(" ")[1]}`' stb_name = f'`{input_sql.split(" ")[1]}`'
@ -1097,7 +1097,7 @@ class TDTestCase:
def defaultTypeCheckCase(self): def defaultTypeCheckCase(self):
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
stb_name = tdCom.getLongName(8, "letters") stb_name = tdCom.getLongName(8, "letters")
input_sql_list = [f'{stb_name}_1 1626006833640 9223372036854775807 t0=f t1=127 t2=32767i16 t3=2147483647i32 t4=9223372036854775807 t5=11.12345f32 t6=22.123456789f64 t7="vozamcts" t8=L"ncharTagValue"', \ input_sql_list = [f'{stb_name}_1 1626006833640 9223372036854775807 t0=f t1=127 t2=32767i16 t3=2147483647i32 t4=9223372036854775807 t5=11.12345f32 t6=22.123456789f64 t7="vozamcts" t8=L"ncharTagValue"', \
f'{stb_name}_2 1626006833641 22.123456789 t0=f t1=127i8 t2=32767I16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789 t7="vozamcts" t8=L"ncharTagValue"', \ f'{stb_name}_2 1626006833641 22.123456789 t0=f t1=127i8 t2=32767I16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789 t7="vozamcts" t8=L"ncharTagValue"', \
@ -1110,7 +1110,7 @@ class TDTestCase:
def tbnameTagsColsNameCheckCase(self): def tbnameTagsColsNameCheckCase(self):
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
if self.smlChildTableName_value == "ID": if self.smlChildTableName_value == "ID":
input_sql = 'rFa$sta 1626006834 9223372036854775807 id=rFas$ta_1 Tt!0=true tT@1=127Ii8 t#2=32767i16 "t$3"=2147483647i32 t%4=9223372036854775807i64 t^5=11.12345f32 t&6=22.123456789f64 t*7=\"ddzhiksj\" t!@#$%^&*()_+[];:<>?,9=L\"ncharTagValue\"' input_sql = 'rFa$sta 1626006834 9223372036854775807 id=rFas$ta_1 Tt!0=true tT@1=127Ii8 t#2=32767i16 "t$3"=2147483647i32 t%4=9223372036854775807i64 t^5=11.12345f32 t&6=22.123456789f64 t*7=\"ddzhiksj\" t!@#$%^&*()_+[];:<>?,9=L\"ncharTagValue\"'
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None) self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
@ -1135,7 +1135,7 @@ class TDTestCase:
stb = "put" stb = "put"
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql = self.genFullTypeSql(tcp_keyword_tag=True, protocol=protocol)[0] input_sql = self.genFullTypeSql(tcp_keyword_tag=True, protocol=protocol)[0]
stb_name = f'`{input_sql.split(" ")[1]}`' stb_name = f'`{input_sql.split(" ")[1]}`'
self.resCmp(input_sql, stb_name, protocol=protocol) self.resCmp(input_sql, stb_name, protocol=protocol)
@ -1204,7 +1204,7 @@ class TDTestCase:
thread input different stb thread input different stb
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql = self.genSqlList()[0] input_sql = self.genSqlList()[0]
print(input_sql) print(input_sql)
self.multiThreadRun(self.genMultiThreadSeq(input_sql)) self.multiThreadRun(self.genMultiThreadSeq(input_sql))
@ -1216,7 +1216,7 @@ class TDTestCase:
thread input same stb tb, different data, result keep first data thread input same stb tb, different data, result keep first data
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
tb_name = tdCom.getLongName(7, "letters") tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"") input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"")
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
@ -1235,7 +1235,7 @@ class TDTestCase:
thread input same stb tb, different data, add columes and tags, result keep first data thread input same stb tb, different data, add columes and tags, result keep first data
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
tb_name = tdCom.getLongName(7, "letters") tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"") input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"")
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
@ -1254,7 +1254,7 @@ class TDTestCase:
thread input same stb tb, different data, minus columes and tags, result keep first data thread input same stb tb, different data, minus columes and tags, result keep first data
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
tb_name = tdCom.getLongName(7, "letters") tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"") input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"")
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
@ -1273,7 +1273,7 @@ class TDTestCase:
thread input same stb, different tb, different data thread input same stb, different tb, different data
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql(value="\"binaryTagValue\"") input_sql, stb_name = self.genFullTypeSql(value="\"binaryTagValue\"")
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
s_stb_d_tb_list = self.genSqlList(stb_name=stb_name)[4] s_stb_d_tb_list = self.genSqlList(stb_name=stb_name)[4]
@ -1286,7 +1286,7 @@ class TDTestCase:
thread input same stb, different tb, different data, add col, mul tag thread input same stb, different tb, different data, add col, mul tag
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql(value="\"binaryTagValue\"") input_sql, stb_name = self.genFullTypeSql(value="\"binaryTagValue\"")
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
s_stb_d_tb_m_tag_list = [(f'{stb_name} 1626006833640 "omfdhyom" t0=F t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64', 'yzwswz'), \ s_stb_d_tb_m_tag_list = [(f'{stb_name} 1626006833640 "omfdhyom" t0=F t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64', 'yzwswz'), \
@ -1303,7 +1303,7 @@ class TDTestCase:
thread input same stb, different tb, different data, add tag, mul col thread input same stb, different tb, different data, add tag, mul col
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql(value="\"binaryTagValue\"") input_sql, stb_name = self.genFullTypeSql(value="\"binaryTagValue\"")
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
s_stb_d_tb_a_tag_list = self.genSqlList(stb_name=stb_name)[6] s_stb_d_tb_a_tag_list = self.genSqlList(stb_name=stb_name)[6]
@ -1316,7 +1316,7 @@ class TDTestCase:
thread input same stb tb, different ts thread input same stb tb, different ts
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
tb_name = tdCom.getLongName(7, "letters") tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"") input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"")
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
@ -1336,7 +1336,7 @@ class TDTestCase:
thread input same stb tb, different ts, add col, mul tag thread input same stb tb, different ts, add col, mul tag
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
tb_name = tdCom.getLongName(7, "letters") tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"") input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"")
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
@ -1354,7 +1354,7 @@ class TDTestCase:
thread input same stb tb, different ts, add tag, mul col thread input same stb tb, different ts, add tag, mul col
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
tb_name = tdCom.getLongName(7, "letters") tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"") input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"")
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
@ -1377,7 +1377,7 @@ class TDTestCase:
thread input same stb, different tb, data, ts thread input same stb, different tb, data, ts
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql(value="\"binaryTagValue\"") input_sql, stb_name = self.genFullTypeSql(value="\"binaryTagValue\"")
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
s_stb_d_tb_d_ts_list = self.genSqlList(stb_name=stb_name)[10] s_stb_d_tb_d_ts_list = self.genSqlList(stb_name=stb_name)[10]
@ -1390,7 +1390,7 @@ class TDTestCase:
thread input same stb, different tb, data, ts, add col, mul tag thread input same stb, different tb, data, ts, add col, mul tag
""" """
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running') tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb() tdCom.cleanTb(dbname="test")
input_sql, stb_name = self.genFullTypeSql(value="\"binaryTagValue\"") input_sql, stb_name = self.genFullTypeSql(value="\"binaryTagValue\"")
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
s_stb_d_tb_d_ts_m_tag_list = [(f'{stb_name} 0 "mnpmtzul" t0=False t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64', 'pcppkg'), \ s_stb_d_tb_d_ts_m_tag_list = [(f'{stb_name} 0 "mnpmtzul" t0=False t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64', 'pcppkg'), \