tdSql.execute("create table db.`%s` as select avg(`%s`) from db.`%s` where ts > now interval(1m) sliding(30s);"%(self.cr_tb1,self.col_bigint,self.stb1))
tdSql.query("show db.tables like 'create_table_%' ")
tdSql.checkRows(1)
print("==============drop\ add\ change\ modify column or tag")
print("==============drop==============")
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; "%(self.stb1,self.tag_ts))
sql=" select * from db.`%s`; "%self.stb1
datacheck=self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; "%self.tb1)
tdSql.checkRows(21)
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; "%(self.stb1,self.tag_double))
sql=" select * from db.`%s`; "%self.stb1
datacheck=self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; "%self.tb1)
tdSql.checkRows(20)
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; "%(self.stb1,self.tag_float))
sql=" select * from db.`%s`; "%self.stb1
datacheck=self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; "%self.tb1)
tdSql.checkRows(19)
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; "%(self.stb1,self.tag_nchar))
sql=" select * from db.`%s`; "%self.stb1
datacheck=self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; "%self.tb1)
tdSql.checkRows(18)
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; "%(self.stb1,self.tag_binary))
sql=" select * from db.`%s`; "%self.stb1
datacheck=self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; "%self.tb1)
tdSql.checkRows(17)
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; "%(self.stb1,self.tag_bool))
sql=" select * from db.`%s`; "%self.stb1
datacheck=self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; "%self.tb1)
tdSql.checkRows(16)
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; "%(self.stb1,self.tag_tinyint))
sql=" select * from db.`%s`; "%self.stb1
datacheck=self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; "%self.tb1)
tdSql.checkRows(15)
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; "%(self.stb1,self.tag_smallint))
sql=" select * from db.`%s`; "%self.stb1
datacheck=self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; "%self.tb1)
tdSql.checkRows(14)
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; "%(self.stb1,self.tag_bigint))
sql=" select * from db.`%s`; "%self.stb1
datacheck=self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; "%self.tb1)
tdSql.checkRows(13)
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; "%(self.stb1,self.tag_int))
sql=" select * from db.`%s`; "%self.stb1
datacheck=self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; "%self.tb1)
tdSql.checkRows(12)
tdSql.execute("ALTER TABLE db.`%s` DROP COLUMN `%s`; "%(self.stb1,self.col_ts))
sql=" select * from db.`%s`; "%self.stb1
datacheck=self.table1_checkall_9(sql)
tdSql.query("describe db.`%s` ; "%self.tb1)
tdSql.checkRows(11)
tdSql.execute("ALTER TABLE db.`%s` DROP COLUMN `%s`; "%(self.stb1,self.col_double))
sql=" select * from db.`%s`; "%self.stb1
datacheck=self.table1_checkall_8(sql)
tdSql.query("describe db.`%s` ; "%self.tb1)
tdSql.checkRows(10)
tdSql.execute("ALTER TABLE db.`%s` DROP COLUMN `%s`; "%(self.stb1,self.col_float))
sql=" select * from db.`%s`; "%self.stb1
datacheck=self.table1_checkall_7(sql)
tdSql.query("describe db.`%s` ; "%self.tb1)
tdSql.checkRows(9)
tdSql.execute("ALTER TABLE db.`%s` DROP COLUMN `%s`; "%(self.stb1,self.col_nchar))
sql=" select * from db.`%s`; "%self.stb1
datacheck=self.table1_checkall_6(sql)
tdSql.query("describe db.`%s` ; "%self.tb1)
tdSql.checkRows(8)
tdSql.execute("ALTER TABLE db.`%s` DROP COLUMN `%s`; "%(self.stb1,self.col_binary))
sql=" select * from db.`%s`; "%self.stb1
datacheck=self.table1_checkall_5(sql)
tdSql.query("describe db.`%s` ; "%self.tb1)
tdSql.checkRows(7)
tdSql.execute("ALTER TABLE db.`%s` DROP COLUMN `%s`; "%(self.stb1,self.col_bool))
sql=" select * from db.`%s`; "%self.stb1
datacheck=self.table1_checkall_4(sql)
tdSql.query("describe db.`%s` ; "%self.tb1)
tdSql.checkRows(6)
tdSql.execute("ALTER TABLE db.`%s` DROP COLUMN `%s`; "%(self.stb1,self.col_tinyint))
sql=" select * from db.`%s`; "%self.stb1
datacheck=self.table1_checkall_3(sql)
tdSql.query("describe db.`%s` ; "%self.tb1)
tdSql.checkRows(5)
tdSql.execute("ALTER TABLE db.`%s` DROP COLUMN `%s`; "%(self.stb1,self.col_smallint))
sql=" select * from db.`%s`; "%self.stb1
datacheck=self.table1_checkall_2(sql)
tdSql.query("describe db.`%s` ; "%self.tb1)
tdSql.checkRows(4)
tdSql.execute("ALTER TABLE db.`%s` DROP COLUMN `%s`; "%(self.stb1,self.col_bigint))
sql=" select * from db.`%s`; "%self.stb1
datacheck=self.table1_checkall_1(sql)
tdSql.query("describe db.`%s` ; "%self.tb1)
tdSql.checkRows(3)
tdSql.error("ALTER TABLE db.`%s` DROP COLUMN `%s`; "%(self.stb1,self.col_int))
sql=" select * from db2.`%s`; "%self.regular_table
datacheck=self.table1_checkall(sql)
tdSql.checkRows(2)
sql=" select * from db2.`%s` where `%s`=1 and `%s`=2 and `%s`=3 and `%s`=4 and `%s`='True' and `%s`=6 and `%s`=7 and `%s`=8 and `%s`=9 and `%s`=10; " \