tdSql.execute("create table if not exists jsons1(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50), dataStrBin binary(150)) tags(jtag json)")
tdSql.execute("create table if not exists jsons1(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50), dataStrBin binary(150)) tags(jtag json)")
whilei<=100000:
whilei<=100000:
sql="""insert into jsons1_{%d} using jsons1 tags('{"tag1":{%d}}') values(1591060618000, 1, false, 'json1', '你是') (1591060608000, 23, true, '等等', 'json')"""%(i,i)
sql="""insert into jsons1_{%d} using jsons1 tags('{"tag1":{%d}}') values(1591060618000, 1, false, 'json1', '你是') (1591060608000, 23, true, '等等', 'json')"""%(i,i)
tdSql.execute(sql)
tdSql.execute(sql)
i=i+1
i=i+1
//doquery
# do query
i=0
i=0
whilei<=100000:
whilei<=100000:
sql="""select count(*) from jsons1 where jtag->'tag1' = %d"""%(i)
sql="""select count(*) from jsons1 where jtag->'tag1' = %d"""%(i)
tdSql.query(sql)
tdSql.query(sql)
if1!=tdSql.getRows():
if1!=tdSql.getRows():
print("err: %s"%(sql))
print("err: %s"%(sql))
whilei<=10000000
whilei<=10000000:
sql="""insert into jsons1_{%d} using jsons1 tags('{"tag1":{%d}}') values(1591060618000, 1, false, 'json1', '你是') (1591060608000, 23, true, '等等', 'json')"""%(i,i)
sql="""insert into jsons1_{%d} using jsons1 tags('{"tag1":{%d}}') values(1591060618000, 1, false, 'json1', '你是') (1591060608000, 23, true, '等等', 'json')"""%(i,i)
tdSql.execute(sql)
tdSql.execute(sql)
i=i+1
i=i+1
i=0
i=0
# drop super table
# drop super table
tdSql.execute("create table if not exists jsons1(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50), dataStrBin binary(150)) tags(jtag json)")
tdSql.execute("create table if not exists jsons1(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50), dataStrBin binary(150)) tags(jtag json)")
...
@@ -76,7 +76,7 @@ class TDTestCase:
...
@@ -76,7 +76,7 @@ class TDTestCase:
tdSql.execute('drop stable jsons1')
tdSql.execute('drop stable jsons1')
# drop database
# drop database
i=0
i=0
tdSql.execute("create table if not exists jsons1(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50), dataStrBin binary(150)) tags(jtag json)")
tdSql.execute("create table if not exists jsons1(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50), dataStrBin binary(150)) tags(jtag json)")
whilei<=100000:
whilei<=100000:
...
@@ -84,10 +84,10 @@ class TDTestCase:
...
@@ -84,10 +84,10 @@ class TDTestCase:
tdSql.execute(sql)
tdSql.execute(sql)
i=i+1
i=i+1
tdSql.execute('drop database db')
tdSql.execute('drop database db')
# test duplicate key using the first one. elimate empty key
# test duplicate key using the first one. elimate empty key
#tdSql.execute("CREATE TABLE if not exists jsons1_8 using jsons1 tags('{\"tag1\":null, \"tag1\":true, \"tag1\":45, \"1tag$\":2, \" \":90, \"\":32}')") tdSql.query("select jtag from jsons1_8") tdSql.checkRows(0);
#tdSql.execute("CREATE TABLE if not exists jsons1_8 using jsons1 tags('{\"tag1\":null, \"tag1\":true, \"tag1\":45, \"1tag$\":2, \" \":90, \"\":32}')") tdSql.query("select jtag from jsons1_8") tdSql.checkRows(0);
#tdSql.query("select ts,jtag from jsons1 order by ts limit 2,3")
#tdSql.query("select ts,jtag from jsons1 order by ts limit 2,3")