From cf4c4e98fde32c5cb6b84c6646dec72b9a9343ae Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Thu, 21 May 2020 16:12:15 +0800 Subject: [PATCH] support log Sql command to file. [TD-383] --- .../python/linux/python3/taos/cursor.py | 8 + tests/pytest/account/account_create.py | 4 +- tests/pytest/account/account_del.py | 4 +- tests/pytest/alter/alter_stable.py | 4 +- tests/pytest/alter/alter_table.py | 4 +- tests/pytest/alter/file_corrupt.py | 4 +- tests/pytest/dbmgmt/database-name-boundary.py | 4 +- tests/pytest/dbmgmt/dropDB_memory_test.py | 4 +- tests/pytest/import_merge/importBlock1H.py | 4 +- tests/pytest/import_merge/importBlock1HO.py | 4 +- tests/pytest/import_merge/importBlock1HPO.py | 4 +- tests/pytest/import_merge/importBlock1S.py | 4 +- tests/pytest/import_merge/importBlock1Sub.py | 4 +- tests/pytest/import_merge/importBlock1T.py | 4 +- tests/pytest/import_merge/importBlock1TO.py | 4 +- tests/pytest/import_merge/importBlock1TPO.py | 4 +- tests/pytest/import_merge/importBlock2H.py | 4 +- tests/pytest/import_merge/importBlock2HO.py | 4 +- tests/pytest/import_merge/importBlock2HPO.py | 4 +- tests/pytest/import_merge/importBlock2S.py | 4 +- tests/pytest/import_merge/importBlock2Sub.py | 4 +- tests/pytest/import_merge/importBlock2T.py | 4 +- tests/pytest/import_merge/importBlock2TO.py | 4 +- tests/pytest/import_merge/importBlock2TPO.py | 4 +- .../pytest/import_merge/importBlockbetween.py | 4 +- tests/pytest/import_merge/importCacheFileH.py | 4 +- .../pytest/import_merge/importCacheFileHO.py | 4 +- .../pytest/import_merge/importCacheFileHPO.py | 4 +- tests/pytest/import_merge/importCacheFileS.py | 4 +- .../pytest/import_merge/importCacheFileSub.py | 4 +- tests/pytest/import_merge/importCacheFileT.py | 4 +- .../pytest/import_merge/importCacheFileTO.py | 4 +- .../pytest/import_merge/importCacheFileTPO.py | 4 +- tests/pytest/import_merge/importDataH2.py | 4 +- tests/pytest/import_merge/importDataHO.py | 4 +- tests/pytest/import_merge/importDataHO2.py | 4 +- tests/pytest/import_merge/importDataHPO.py | 4 +- tests/pytest/import_merge/importDataLastH.py | 4 +- tests/pytest/import_merge/importDataLastHO.py | 4 +- .../pytest/import_merge/importDataLastHPO.py | 4 +- tests/pytest/import_merge/importDataLastS.py | 4 +- .../pytest/import_merge/importDataLastSub.py | 4 +- tests/pytest/import_merge/importDataLastT.py | 4 +- tests/pytest/import_merge/importDataLastTO.py | 4 +- .../pytest/import_merge/importDataLastTPO.py | 4 +- tests/pytest/import_merge/importDataS.py | 4 +- tests/pytest/import_merge/importDataSub.py | 4 +- tests/pytest/import_merge/importDataT.py | 4 +- tests/pytest/import_merge/importDataTO.py | 4 +- tests/pytest/import_merge/importDataTPO.py | 4 +- tests/pytest/import_merge/importHORestart.py | 4 +- tests/pytest/import_merge/importHPORestart.py | 4 +- tests/pytest/import_merge/importHRestart.py | 4 +- tests/pytest/import_merge/importHead.py | 4 +- .../pytest/import_merge/importHeadOverlap.py | 4 +- .../import_merge/importHeadPartOverlap.py | 4 +- tests/pytest/import_merge/importLastH.py | 4 +- tests/pytest/import_merge/importLastHO.py | 4 +- tests/pytest/import_merge/importLastHPO.py | 4 +- tests/pytest/import_merge/importLastS.py | 4 +- tests/pytest/import_merge/importLastSub.py | 4 +- tests/pytest/import_merge/importLastT.py | 4 +- tests/pytest/import_merge/importLastTO.py | 4 +- tests/pytest/import_merge/importLastTPO.py | 4 +- tests/pytest/import_merge/importSRestart.py | 4 +- tests/pytest/import_merge/importSpan.py | 4 +- tests/pytest/import_merge/importSubRestart.py | 4 +- tests/pytest/import_merge/importTORestart.py | 4 +- tests/pytest/import_merge/importTPORestart.py | 4 +- tests/pytest/import_merge/importTRestart.py | 4 +- tests/pytest/import_merge/importTail.py | 4 +- .../pytest/import_merge/importTailOverlap.py | 4 +- .../import_merge/importTailPartOverlap.py | 4 +- tests/pytest/import_merge/importToCommit.py | 4 +- tests/pytest/insert/basic.py | 4 +- tests/pytest/insert/bigint.py | 4 +- tests/pytest/insert/binary-boundary.py | 4 +- tests/pytest/insert/binary.py | 4 +- tests/pytest/insert/bool.py | 4 +- tests/pytest/insert/date.py | 4 +- tests/pytest/insert/double.py | 4 +- tests/pytest/insert/float.py | 4 +- tests/pytest/insert/int.py | 4 +- tests/pytest/insert/multi.py | 4 +- tests/pytest/insert/nchar-boundary.py | 4 +- tests/pytest/insert/nchar-unicode.py | 4 +- tests/pytest/insert/nchar.py | 4 +- tests/pytest/insert/smallint.py | 4 +- tests/pytest/insert/tinyint.py | 4 +- tests/pytest/query/query.py | 4 +- tests/pytest/query/tbname.py | 4 +- tests/pytest/random-test/random-test.py | 4 +- tests/pytest/stable/insert.py | 4 +- tests/pytest/table/alter_column.py | 4 +- tests/pytest/table/boundary.py | 138 +++++++++--------- tests/pytest/table/column_name.py | 4 +- tests/pytest/table/column_num.py | 4 +- tests/pytest/table/create-a-lot.py | 45 ++++++ tests/pytest/table/create.py | 4 +- tests/pytest/table/db_table.py | 4 +- tests/pytest/table/del_stable.py | 4 +- tests/pytest/table/tablename-boundary.py | 4 +- tests/pytest/tag_lite/3.py | 4 +- tests/pytest/tag_lite/4.py | 4 +- tests/pytest/tag_lite/5.py | 4 +- tests/pytest/tag_lite/6.py | 4 +- tests/pytest/tag_lite/add.py | 4 +- tests/pytest/tag_lite/bigint.py | 4 +- tests/pytest/tag_lite/binary.py | 4 +- tests/pytest/tag_lite/binary_binary.py | 4 +- tests/pytest/tag_lite/bool.py | 4 +- tests/pytest/tag_lite/bool_binary.py | 4 +- tests/pytest/tag_lite/bool_int.py | 4 +- tests/pytest/tag_lite/change.py | 4 +- tests/pytest/tag_lite/column.py | 4 +- tests/pytest/tag_lite/commit.py | 4 +- tests/pytest/tag_lite/create-tags-boundary.py | 4 +- tests/pytest/tag_lite/create.py | 4 +- .../pytest/tag_lite/datatype-without-alter.py | 4 +- tests/pytest/tag_lite/datatype.py | 4 +- tests/pytest/tag_lite/delete.py | 4 +- tests/pytest/tag_lite/double.py | 4 +- tests/pytest/tag_lite/filter.py | 4 +- tests/pytest/tag_lite/float.py | 4 +- tests/pytest/tag_lite/int.py | 4 +- tests/pytest/tag_lite/int_binary.py | 4 +- tests/pytest/tag_lite/int_float.py | 4 +- tests/pytest/tag_lite/set.py | 4 +- tests/pytest/tag_lite/smallint.py | 4 +- tests/pytest/tag_lite/tinyint.py | 4 +- tests/pytest/test.py | 20 ++- tests/pytest/user/pass_len.py | 4 +- tests/pytest/user/user_create.py | 4 +- tests/pytest/util/cases.py | 6 +- tests/pytest/util/sql.py | 9 +- 135 files changed, 405 insertions(+), 337 deletions(-) create mode 100644 tests/pytest/table/create-a-lot.py diff --git a/src/connector/python/linux/python3/taos/cursor.py b/src/connector/python/linux/python3/taos/cursor.py index ea7e9e5404..dc038a72ba 100644 --- a/src/connector/python/linux/python3/taos/cursor.py +++ b/src/connector/python/linux/python3/taos/cursor.py @@ -36,6 +36,7 @@ class TDengineCursor(object): self._block_rows = -1 self._block_iter = 0 self._affected_rows = 0 + self._logfile = "" if connection is not None: self._connection = connection @@ -85,6 +86,9 @@ class TDengineCursor(object): """ pass + def log(self, logfile): + self._logfile = logfile + def close(self): """Close the cursor. """ @@ -121,6 +125,10 @@ class TDengineCursor(object): res = CTaosInterface.query(self._connection._conn, stmt) # print(" << Query ({}) Exec Done".format(localSeqNum)) + if (self._logfile): + with open(self._logfile, "a") as logfile: + logfile.write("%s;\n" % operation) + if res == 0: if CTaosInterface.fieldsCount(self._connection._conn) == 0: self._affected_rows += CTaosInterface.affectedRows( diff --git a/tests/pytest/account/account_create.py b/tests/pytest/account/account_create.py index 24bcc8df2f..85adfff199 100644 --- a/tests/pytest/account/account_create.py +++ b/tests/pytest/account/account_create.py @@ -19,9 +19,9 @@ from util.sql import tdSql class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): try: diff --git a/tests/pytest/account/account_del.py b/tests/pytest/account/account_del.py index 43690c6e37..7f05a39765 100644 --- a/tests/pytest/account/account_del.py +++ b/tests/pytest/account/account_del.py @@ -19,9 +19,9 @@ from util.sql import tdSql class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): print("==========step1") diff --git a/tests/pytest/alter/alter_stable.py b/tests/pytest/alter/alter_stable.py index 5772edcf7f..6852f4ef4a 100644 --- a/tests/pytest/alter/alter_stable.py +++ b/tests/pytest/alter/alter_stable.py @@ -9,9 +9,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) self.types = [ "int", "bigint", diff --git a/tests/pytest/alter/alter_table.py b/tests/pytest/alter/alter_table.py index 6e0c591da6..6d4f72556b 100644 --- a/tests/pytest/alter/alter_table.py +++ b/tests/pytest/alter/alter_table.py @@ -9,9 +9,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) self.types = [ "int", "bigint", diff --git a/tests/pytest/alter/file_corrupt.py b/tests/pytest/alter/file_corrupt.py index 51ea882270..28d50cdd38 100644 --- a/tests/pytest/alter/file_corrupt.py +++ b/tests/pytest/alter/file_corrupt.py @@ -19,9 +19,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/dbmgmt/database-name-boundary.py b/tests/pytest/dbmgmt/database-name-boundary.py index ff6dce22ae..df3b027ba7 100644 --- a/tests/pytest/dbmgmt/database-name-boundary.py +++ b/tests/pytest/dbmgmt/database-name-boundary.py @@ -23,9 +23,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): diff --git a/tests/pytest/dbmgmt/dropDB_memory_test.py b/tests/pytest/dbmgmt/dropDB_memory_test.py index b029945be2..0f0925c268 100644 --- a/tests/pytest/dbmgmt/dropDB_memory_test.py +++ b/tests/pytest/dbmgmt/dropDB_memory_test.py @@ -19,9 +19,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/import_merge/importBlock1H.py b/tests/pytest/import_merge/importBlock1H.py index aef29444d6..fca37ff1b1 100644 --- a/tests/pytest/import_merge/importBlock1H.py +++ b/tests/pytest/import_merge/importBlock1H.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock1HO.py b/tests/pytest/import_merge/importBlock1HO.py index ad4bcf1288..c853d3a6af 100644 --- a/tests/pytest/import_merge/importBlock1HO.py +++ b/tests/pytest/import_merge/importBlock1HO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock1HPO.py b/tests/pytest/import_merge/importBlock1HPO.py index 6aabc035ec..968f21f50f 100644 --- a/tests/pytest/import_merge/importBlock1HPO.py +++ b/tests/pytest/import_merge/importBlock1HPO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock1S.py b/tests/pytest/import_merge/importBlock1S.py index 4b2adfb961..6a0ce18edf 100644 --- a/tests/pytest/import_merge/importBlock1S.py +++ b/tests/pytest/import_merge/importBlock1S.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock1Sub.py b/tests/pytest/import_merge/importBlock1Sub.py index 343b87c757..2eaf5fc26e 100644 --- a/tests/pytest/import_merge/importBlock1Sub.py +++ b/tests/pytest/import_merge/importBlock1Sub.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock1T.py b/tests/pytest/import_merge/importBlock1T.py index 40f4bbfdec..ffac67a7e1 100644 --- a/tests/pytest/import_merge/importBlock1T.py +++ b/tests/pytest/import_merge/importBlock1T.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock1TO.py b/tests/pytest/import_merge/importBlock1TO.py index db8b036d6f..5d6c6624d9 100644 --- a/tests/pytest/import_merge/importBlock1TO.py +++ b/tests/pytest/import_merge/importBlock1TO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock1TPO.py b/tests/pytest/import_merge/importBlock1TPO.py index f2361712e7..e7807e892a 100644 --- a/tests/pytest/import_merge/importBlock1TPO.py +++ b/tests/pytest/import_merge/importBlock1TPO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock2H.py b/tests/pytest/import_merge/importBlock2H.py index 62552980bd..eea1e4bcf8 100644 --- a/tests/pytest/import_merge/importBlock2H.py +++ b/tests/pytest/import_merge/importBlock2H.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock2HO.py b/tests/pytest/import_merge/importBlock2HO.py index 0f53210f4a..99a9662f1c 100644 --- a/tests/pytest/import_merge/importBlock2HO.py +++ b/tests/pytest/import_merge/importBlock2HO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock2HPO.py b/tests/pytest/import_merge/importBlock2HPO.py index 3b7ffbbe44..54afef6c06 100644 --- a/tests/pytest/import_merge/importBlock2HPO.py +++ b/tests/pytest/import_merge/importBlock2HPO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock2S.py b/tests/pytest/import_merge/importBlock2S.py index 69b0291839..9d4757709a 100644 --- a/tests/pytest/import_merge/importBlock2S.py +++ b/tests/pytest/import_merge/importBlock2S.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock2Sub.py b/tests/pytest/import_merge/importBlock2Sub.py index 5b93750584..db43a492bc 100644 --- a/tests/pytest/import_merge/importBlock2Sub.py +++ b/tests/pytest/import_merge/importBlock2Sub.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock2T.py b/tests/pytest/import_merge/importBlock2T.py index 0d9b70299d..c0d85fa3b0 100644 --- a/tests/pytest/import_merge/importBlock2T.py +++ b/tests/pytest/import_merge/importBlock2T.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock2TO.py b/tests/pytest/import_merge/importBlock2TO.py index fe57308c42..05692c336d 100644 --- a/tests/pytest/import_merge/importBlock2TO.py +++ b/tests/pytest/import_merge/importBlock2TO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock2TPO.py b/tests/pytest/import_merge/importBlock2TPO.py index 4da52bd3f4..817d2db382 100644 --- a/tests/pytest/import_merge/importBlock2TPO.py +++ b/tests/pytest/import_merge/importBlock2TPO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlockbetween.py b/tests/pytest/import_merge/importBlockbetween.py index eea7f7ea7c..2e4ac8a737 100644 --- a/tests/pytest/import_merge/importBlockbetween.py +++ b/tests/pytest/import_merge/importBlockbetween.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importCacheFileH.py b/tests/pytest/import_merge/importCacheFileH.py index cd2b3a73f1..3398f7bdad 100644 --- a/tests/pytest/import_merge/importCacheFileH.py +++ b/tests/pytest/import_merge/importCacheFileH.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importCacheFileHO.py b/tests/pytest/import_merge/importCacheFileHO.py index 2e65c337b7..19520dc3d0 100644 --- a/tests/pytest/import_merge/importCacheFileHO.py +++ b/tests/pytest/import_merge/importCacheFileHO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importCacheFileHPO.py b/tests/pytest/import_merge/importCacheFileHPO.py index f01ebd0d60..9e0a57fb46 100644 --- a/tests/pytest/import_merge/importCacheFileHPO.py +++ b/tests/pytest/import_merge/importCacheFileHPO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importCacheFileS.py b/tests/pytest/import_merge/importCacheFileS.py index 0bb9107562..2f0af569e5 100644 --- a/tests/pytest/import_merge/importCacheFileS.py +++ b/tests/pytest/import_merge/importCacheFileS.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importCacheFileSub.py b/tests/pytest/import_merge/importCacheFileSub.py index cd5d250968..300bb6e8d0 100644 --- a/tests/pytest/import_merge/importCacheFileSub.py +++ b/tests/pytest/import_merge/importCacheFileSub.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importCacheFileT.py b/tests/pytest/import_merge/importCacheFileT.py index be79e26bc7..ab33cf6a93 100644 --- a/tests/pytest/import_merge/importCacheFileT.py +++ b/tests/pytest/import_merge/importCacheFileT.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importCacheFileTO.py b/tests/pytest/import_merge/importCacheFileTO.py index dd17de3adf..00e22da976 100644 --- a/tests/pytest/import_merge/importCacheFileTO.py +++ b/tests/pytest/import_merge/importCacheFileTO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importCacheFileTPO.py b/tests/pytest/import_merge/importCacheFileTPO.py index 948b99ed21..c6089e1d68 100644 --- a/tests/pytest/import_merge/importCacheFileTPO.py +++ b/tests/pytest/import_merge/importCacheFileTPO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataH2.py b/tests/pytest/import_merge/importDataH2.py index b5e53d862e..a21f0c47be 100644 --- a/tests/pytest/import_merge/importDataH2.py +++ b/tests/pytest/import_merge/importDataH2.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataHO.py b/tests/pytest/import_merge/importDataHO.py index f6d65a5c53..fdcaedd83c 100644 --- a/tests/pytest/import_merge/importDataHO.py +++ b/tests/pytest/import_merge/importDataHO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataHO2.py b/tests/pytest/import_merge/importDataHO2.py index 6246b55b32..b094701132 100644 --- a/tests/pytest/import_merge/importDataHO2.py +++ b/tests/pytest/import_merge/importDataHO2.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataHPO.py b/tests/pytest/import_merge/importDataHPO.py index c749dbd113..9d74c0c352 100644 --- a/tests/pytest/import_merge/importDataHPO.py +++ b/tests/pytest/import_merge/importDataHPO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataLastH.py b/tests/pytest/import_merge/importDataLastH.py index 830711a420..c8e5f62423 100644 --- a/tests/pytest/import_merge/importDataLastH.py +++ b/tests/pytest/import_merge/importDataLastH.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataLastHO.py b/tests/pytest/import_merge/importDataLastHO.py index 037c81f087..33215997a4 100644 --- a/tests/pytest/import_merge/importDataLastHO.py +++ b/tests/pytest/import_merge/importDataLastHO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataLastHPO.py b/tests/pytest/import_merge/importDataLastHPO.py index 46a7e5909d..fa8542f35b 100644 --- a/tests/pytest/import_merge/importDataLastHPO.py +++ b/tests/pytest/import_merge/importDataLastHPO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataLastS.py b/tests/pytest/import_merge/importDataLastS.py index 2dd7cdb744..2f595fef54 100644 --- a/tests/pytest/import_merge/importDataLastS.py +++ b/tests/pytest/import_merge/importDataLastS.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataLastSub.py b/tests/pytest/import_merge/importDataLastSub.py index bb9953057e..5c2069c90f 100644 --- a/tests/pytest/import_merge/importDataLastSub.py +++ b/tests/pytest/import_merge/importDataLastSub.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataLastT.py b/tests/pytest/import_merge/importDataLastT.py index 29f0afaf1a..08e944eb68 100644 --- a/tests/pytest/import_merge/importDataLastT.py +++ b/tests/pytest/import_merge/importDataLastT.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataLastTO.py b/tests/pytest/import_merge/importDataLastTO.py index 47639130b5..a82c054141 100644 --- a/tests/pytest/import_merge/importDataLastTO.py +++ b/tests/pytest/import_merge/importDataLastTO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataLastTPO.py b/tests/pytest/import_merge/importDataLastTPO.py index 4190836505..ff75a1b2ae 100644 --- a/tests/pytest/import_merge/importDataLastTPO.py +++ b/tests/pytest/import_merge/importDataLastTPO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataS.py b/tests/pytest/import_merge/importDataS.py index daa4b2e025..37627e8d6b 100644 --- a/tests/pytest/import_merge/importDataS.py +++ b/tests/pytest/import_merge/importDataS.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataSub.py b/tests/pytest/import_merge/importDataSub.py index e946a254c2..17e2b141b7 100644 --- a/tests/pytest/import_merge/importDataSub.py +++ b/tests/pytest/import_merge/importDataSub.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataT.py b/tests/pytest/import_merge/importDataT.py index abb5e312ef..b0b7b82b79 100644 --- a/tests/pytest/import_merge/importDataT.py +++ b/tests/pytest/import_merge/importDataT.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataTO.py b/tests/pytest/import_merge/importDataTO.py index 2a6d9e272b..c0b57136af 100644 --- a/tests/pytest/import_merge/importDataTO.py +++ b/tests/pytest/import_merge/importDataTO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataTPO.py b/tests/pytest/import_merge/importDataTPO.py index 06d5cf3c1a..8a1c9264b4 100644 --- a/tests/pytest/import_merge/importDataTPO.py +++ b/tests/pytest/import_merge/importDataTPO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importHORestart.py b/tests/pytest/import_merge/importHORestart.py index cfbfa61c90..f74c4c76d6 100644 --- a/tests/pytest/import_merge/importHORestart.py +++ b/tests/pytest/import_merge/importHORestart.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importHPORestart.py b/tests/pytest/import_merge/importHPORestart.py index 7e96d44a1a..e5f79fbe6c 100644 --- a/tests/pytest/import_merge/importHPORestart.py +++ b/tests/pytest/import_merge/importHPORestart.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importHRestart.py b/tests/pytest/import_merge/importHRestart.py index aa1783977e..be67039789 100644 --- a/tests/pytest/import_merge/importHRestart.py +++ b/tests/pytest/import_merge/importHRestart.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importHead.py b/tests/pytest/import_merge/importHead.py index 6971986ebc..80e6d92c69 100644 --- a/tests/pytest/import_merge/importHead.py +++ b/tests/pytest/import_merge/importHead.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importHeadOverlap.py b/tests/pytest/import_merge/importHeadOverlap.py index df5f07b5a2..535c0c2859 100644 --- a/tests/pytest/import_merge/importHeadOverlap.py +++ b/tests/pytest/import_merge/importHeadOverlap.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importHeadPartOverlap.py b/tests/pytest/import_merge/importHeadPartOverlap.py index 8c9885e22f..85ddd64f0a 100644 --- a/tests/pytest/import_merge/importHeadPartOverlap.py +++ b/tests/pytest/import_merge/importHeadPartOverlap.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importLastH.py b/tests/pytest/import_merge/importLastH.py index a6f9fa087c..17fa233e37 100644 --- a/tests/pytest/import_merge/importLastH.py +++ b/tests/pytest/import_merge/importLastH.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importLastHO.py b/tests/pytest/import_merge/importLastHO.py index e6468b243e..adb44fc0ea 100644 --- a/tests/pytest/import_merge/importLastHO.py +++ b/tests/pytest/import_merge/importLastHO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importLastHPO.py b/tests/pytest/import_merge/importLastHPO.py index 4a299ed823..d8ed2d9ef1 100644 --- a/tests/pytest/import_merge/importLastHPO.py +++ b/tests/pytest/import_merge/importLastHPO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importLastS.py b/tests/pytest/import_merge/importLastS.py index 2a5de46eb2..bf222a0d5f 100644 --- a/tests/pytest/import_merge/importLastS.py +++ b/tests/pytest/import_merge/importLastS.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importLastSub.py b/tests/pytest/import_merge/importLastSub.py index fa1b2387f3..5a6b9f4150 100644 --- a/tests/pytest/import_merge/importLastSub.py +++ b/tests/pytest/import_merge/importLastSub.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importLastT.py b/tests/pytest/import_merge/importLastT.py index b7a1e58bc5..2b1be1fe2b 100644 --- a/tests/pytest/import_merge/importLastT.py +++ b/tests/pytest/import_merge/importLastT.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importLastTO.py b/tests/pytest/import_merge/importLastTO.py index 541cbd29ca..ce189f6371 100644 --- a/tests/pytest/import_merge/importLastTO.py +++ b/tests/pytest/import_merge/importLastTO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importLastTPO.py b/tests/pytest/import_merge/importLastTPO.py index 6ec21d0c79..627d090855 100644 --- a/tests/pytest/import_merge/importLastTPO.py +++ b/tests/pytest/import_merge/importLastTPO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importSRestart.py b/tests/pytest/import_merge/importSRestart.py index 0771b8bf9c..29f5a19b54 100644 --- a/tests/pytest/import_merge/importSRestart.py +++ b/tests/pytest/import_merge/importSRestart.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importSpan.py b/tests/pytest/import_merge/importSpan.py index 736c4bad64..4e20e9754f 100644 --- a/tests/pytest/import_merge/importSpan.py +++ b/tests/pytest/import_merge/importSpan.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importSubRestart.py b/tests/pytest/import_merge/importSubRestart.py index f7f33d32c1..b1a6f30c43 100644 --- a/tests/pytest/import_merge/importSubRestart.py +++ b/tests/pytest/import_merge/importSubRestart.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importTORestart.py b/tests/pytest/import_merge/importTORestart.py index 194756cd12..07eb6c28cb 100644 --- a/tests/pytest/import_merge/importTORestart.py +++ b/tests/pytest/import_merge/importTORestart.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importTPORestart.py b/tests/pytest/import_merge/importTPORestart.py index 36d4b64390..10bbf3efce 100644 --- a/tests/pytest/import_merge/importTPORestart.py +++ b/tests/pytest/import_merge/importTPORestart.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importTRestart.py b/tests/pytest/import_merge/importTRestart.py index 9308518d8c..63a9368eca 100644 --- a/tests/pytest/import_merge/importTRestart.py +++ b/tests/pytest/import_merge/importTRestart.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importTail.py b/tests/pytest/import_merge/importTail.py index a80db730a0..a552edb244 100644 --- a/tests/pytest/import_merge/importTail.py +++ b/tests/pytest/import_merge/importTail.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importTailOverlap.py b/tests/pytest/import_merge/importTailOverlap.py index 98596d2f77..78e51f93f9 100644 --- a/tests/pytest/import_merge/importTailOverlap.py +++ b/tests/pytest/import_merge/importTailOverlap.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importTailPartOverlap.py b/tests/pytest/import_merge/importTailPartOverlap.py index 0263114a25..e433cb66f3 100644 --- a/tests/pytest/import_merge/importTailPartOverlap.py +++ b/tests/pytest/import_merge/importTailPartOverlap.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importToCommit.py b/tests/pytest/import_merge/importToCommit.py index b1a0065d47..6cac2ed6bf 100644 --- a/tests/pytest/import_merge/importToCommit.py +++ b/tests/pytest/import_merge/importToCommit.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/insert/basic.py b/tests/pytest/insert/basic.py index 35f830d951..dcb5834d55 100644 --- a/tests/pytest/insert/basic.py +++ b/tests/pytest/insert/basic.py @@ -18,9 +18,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/insert/bigint.py b/tests/pytest/insert/bigint.py index 214200900a..7c7d2d0f95 100644 --- a/tests/pytest/insert/bigint.py +++ b/tests/pytest/insert/bigint.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/insert/binary-boundary.py b/tests/pytest/insert/binary-boundary.py index 583217a732..bb86ddf61c 100644 --- a/tests/pytest/insert/binary-boundary.py +++ b/tests/pytest/insert/binary-boundary.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/insert/binary.py b/tests/pytest/insert/binary.py index 677ae4bf29..0d583aa2cc 100644 --- a/tests/pytest/insert/binary.py +++ b/tests/pytest/insert/binary.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/insert/bool.py b/tests/pytest/insert/bool.py index c175afd8b5..1412567cd7 100644 --- a/tests/pytest/insert/bool.py +++ b/tests/pytest/insert/bool.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/insert/date.py b/tests/pytest/insert/date.py index fb7f1816c4..6e22e5b72e 100644 --- a/tests/pytest/insert/date.py +++ b/tests/pytest/insert/date.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/insert/double.py b/tests/pytest/insert/double.py index 19be9653c0..1b66ed1c44 100644 --- a/tests/pytest/insert/double.py +++ b/tests/pytest/insert/double.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/insert/float.py b/tests/pytest/insert/float.py index 414833877e..8b6277d436 100644 --- a/tests/pytest/insert/float.py +++ b/tests/pytest/insert/float.py @@ -19,9 +19,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/insert/int.py b/tests/pytest/insert/int.py index 350426a5bd..4a94a331d6 100644 --- a/tests/pytest/insert/int.py +++ b/tests/pytest/insert/int.py @@ -20,9 +20,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/insert/multi.py b/tests/pytest/insert/multi.py index c14d7dc2e0..5f81f12fdb 100644 --- a/tests/pytest/insert/multi.py +++ b/tests/pytest/insert/multi.py @@ -20,9 +20,9 @@ from util.sql import tdSql class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/insert/nchar-boundary.py b/tests/pytest/insert/nchar-boundary.py index 255cc5b79a..05a66f6066 100644 --- a/tests/pytest/insert/nchar-boundary.py +++ b/tests/pytest/insert/nchar-boundary.py @@ -18,9 +18,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/insert/nchar-unicode.py b/tests/pytest/insert/nchar-unicode.py index 12eef379d3..152a09723e 100644 --- a/tests/pytest/insert/nchar-unicode.py +++ b/tests/pytest/insert/nchar-unicode.py @@ -18,9 +18,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/insert/nchar.py b/tests/pytest/insert/nchar.py index d61a44844d..b8e365f143 100644 --- a/tests/pytest/insert/nchar.py +++ b/tests/pytest/insert/nchar.py @@ -18,9 +18,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/insert/smallint.py b/tests/pytest/insert/smallint.py index 0d85e45cfa..16322e9aeb 100644 --- a/tests/pytest/insert/smallint.py +++ b/tests/pytest/insert/smallint.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/insert/tinyint.py b/tests/pytest/insert/tinyint.py index 6d7178054e..a10c999e8c 100644 --- a/tests/pytest/insert/tinyint.py +++ b/tests/pytest/insert/tinyint.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/query/query.py b/tests/pytest/query/query.py index 68b8baab64..da0ef96d0e 100644 --- a/tests/pytest/query/query.py +++ b/tests/pytest/query/query.py @@ -19,9 +19,9 @@ from util.sql import tdSql class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/query/tbname.py b/tests/pytest/query/tbname.py index 5ea89fff82..08416ba3ed 100644 --- a/tests/pytest/query/tbname.py +++ b/tests/pytest/query/tbname.py @@ -19,9 +19,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/random-test/random-test.py b/tests/pytest/random-test/random-test.py index a3f4c00ea5..7caa07e5d2 100644 --- a/tests/pytest/random-test/random-test.py +++ b/tests/pytest/random-test/random-test.py @@ -110,9 +110,9 @@ class Test: class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/stable/insert.py b/tests/pytest/stable/insert.py index 9f9e7c6e06..3d37e6726c 100644 --- a/tests/pytest/stable/insert.py +++ b/tests/pytest/stable/insert.py @@ -19,9 +19,9 @@ from util.sql import tdSql class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/table/alter_column.py b/tests/pytest/table/alter_column.py index 15bc9f7aa7..73fdbe1ae9 100644 --- a/tests/pytest/table/alter_column.py +++ b/tests/pytest/table/alter_column.py @@ -20,9 +20,9 @@ from util.sql import tdSql class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/table/boundary.py b/tests/pytest/table/boundary.py index faa222231b..b68671c61a 100644 --- a/tests/pytest/table/boundary.py +++ b/tests/pytest/table/boundary.py @@ -10,140 +10,133 @@ from util.sql import * class TDTestCase: - def init( self, conn ): + def init(self, conn): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) - - def getLimitFromSourceCode( self, name ): + def getLimitFromSourceCode(self, name): cmd = "grep -w '#define %s' ../../src/inc/taosdef.h|awk '{print $3}'" % name return int(subprocess.check_output(cmd, shell=True)) - - def generateString( self, length ): + def generateString(self, length): chars = string.ascii_uppercase + string.ascii_lowercase v = "" - for i in range( length ): - v += random.choice( chars ) + for i in range(length): + v += random.choice(chars) return v - - def checkTagBoundaries( self ): - tdLog.debug( "checking tag boundaries" ) + def checkTagBoundaries(self): + tdLog.debug("checking tag boundaries") tdSql.prepare() - maxTags = self.getLimitFromSourceCode( 'TSDB_MAX_TAGS' ) - totalTagsLen = self.getLimitFromSourceCode( 'TSDB_MAX_TAGS_LEN' ) - tdLog.notice( "max tags is %d" % maxTags ) - tdLog.notice( "max total tag length is %d" % totalTagsLen ) + maxTags = self.getLimitFromSourceCode('TSDB_MAX_TAGS') + totalTagsLen = self.getLimitFromSourceCode('TSDB_MAX_TAGS_LEN') + tdLog.notice("max tags is %d" % maxTags) + tdLog.notice("max total tag length is %d" % totalTagsLen) # for binary tags, 2 bytes are used for length tagLen = (totalTagsLen - maxTags * 2) // maxTags firstTagLen = totalTagsLen - 2 * maxTags - tagLen * (maxTags - 1) sql = "create table cars(ts timestamp, f int) tags(t0 binary(%d)" % firstTagLen - for i in range( 1, maxTags ): + for i in range(1, maxTags): sql += ", t%d binary(%d)" % (i, tagLen) sql += ");" - tdLog.debug( "creating super table: " + sql ) - tdSql.execute( sql ) - tdSql.query( 'show stables' ) - tdSql.checkRows( 1 ) + tdLog.debug("creating super table: " + sql) + tdSql.execute(sql) + tdSql.query('show stables') + tdSql.checkRows(1) - for i in range( 10 ): + for i in range(10): sql = "create table car%d using cars tags('%d'" % (i, i) sql += ", '0'" * (maxTags - 1) + ");" - tdLog.debug( "creating table: " + sql ) - tdSql.execute( sql ) + tdLog.debug("creating table: " + sql) + tdSql.execute(sql) sql = "insert into car%d values(now, 0);" % i - tdLog.debug( "inserting data: " + sql ) - tdSql.execute( sql ) - - tdSql.query( 'show tables' ) - tdLog.info( 'tdSql.checkRow(10)' ) - tdSql.checkRows( 10 ) + tdLog.debug("inserting data: " + sql) + tdSql.execute(sql) - tdSql.query( 'select * from cars;' ) - tdSql.checkRows( 10 ) + tdSql.query('show tables') + tdLog.info('tdSql.checkRow(10)') + tdSql.checkRows(10) + tdSql.query('select * from cars;') + tdSql.checkRows(10) - def checkColumnBoundaries( self ): - tdLog.debug( "checking column boundaries" ) + def checkColumnBoundaries(self): + tdLog.debug("checking column boundaries") tdSql.prepare() # one column is for timestamp - maxCols = self.getLimitFromSourceCode( 'TSDB_MAX_COLUMNS' ) - 1 + maxCols = self.getLimitFromSourceCode('TSDB_MAX_COLUMNS') - 1 sql = "create table cars (ts timestamp" - for i in range( maxCols ): + for i in range(maxCols): sql += ", c%d int" % i sql += ");" - tdSql.execute( sql ) - tdSql.query( 'show tables' ) - tdSql.checkRows( 1 ) + tdSql.execute(sql) + tdSql.query('show tables') + tdSql.checkRows(1) sql = "insert into cars values (now" - for i in range( maxCols ): + for i in range(maxCols): sql += ", %d" % i sql += ");" - tdSql.execute( sql ) - tdSql.query( 'select * from cars' ) - tdSql.checkRows( 1 ) + tdSql.execute(sql) + tdSql.query('select * from cars') + tdSql.checkRows(1) - - def checkTableNameBoundaries( self ): - tdLog.debug( "checking table name boundaries" ) + def checkTableNameBoundaries(self): + tdLog.debug("checking table name boundaries") tdSql.prepare() - maxTableNameLen = self.getLimitFromSourceCode( 'TSDB_TABLE_NAME_LEN' ) - tdLog.notice( "table name max length is %d" % maxTableNameLen ) - - name = self.generateString( maxTableNameLen - 1) - tdLog.info( "table name is '%s'" % name ) + maxTableNameLen = self.getLimitFromSourceCode('TSDB_TABLE_NAME_LEN') + tdLog.notice("table name max length is %d" % maxTableNameLen) - tdSql.execute( "create table %s (ts timestamp, value int)" % name ) - tdSql.execute( "insert into %s values(now, 0)" % name ) + name = self.generateString(maxTableNameLen - 1) + tdLog.info("table name is '%s'" % name) - tdSql.query( 'show tables' ) - tdSql.checkRows( 1 ) + tdSql.execute("create table %s (ts timestamp, value int)" % name) + tdSql.execute("insert into %s values(now, 0)" % name) - tdSql.query( 'select * from %s' % name ) - tdSql.checkRows( 1 ) + tdSql.query('show tables') + tdSql.checkRows(1) + tdSql.query('select * from %s' % name) + tdSql.checkRows(1) - def checkRowBoundaries( self ): - tdLog.debug( "checking row boundaries" ) + def checkRowBoundaries(self): + tdLog.debug("checking row boundaries") tdSql.prepare() # 8 bytes for timestamp maxRowSize = 65536 - 8 - maxCols = self.getLimitFromSourceCode( 'TSDB_MAX_COLUMNS' ) - 1 + maxCols = self.getLimitFromSourceCode('TSDB_MAX_COLUMNS') - 1 # for binary cols, 2 bytes are used for length colLen = (maxRowSize - maxCols * 2) // maxCols firstColLen = maxRowSize - 2 * maxCols - colLen * (maxCols - 1) sql = "create table cars (ts timestamp, c0 binary(%d)" % firstColLen - for i in range( 1, maxCols ): + for i in range(1, maxCols): sql += ", c%d binary(%d)" % (i, colLen) sql += ");" - tdSql.execute( sql ) - tdSql.query( 'show tables' ) - tdSql.checkRows( 1 ) + tdSql.execute(sql) + tdSql.query('show tables') + tdSql.checkRows(1) - col = self.generateString( firstColLen ) + col = self.generateString(firstColLen) sql = "insert into cars values (now, '%s'" % col - col = self.generateString( colLen ) - for i in range( 1, maxCols ): - sql += ", '%s'" % col + col = self.generateString(colLen) + for i in range(1, maxCols): + sql += ", '%s'" % col sql += ");" - tdLog.info( sql ); - tdSql.execute( sql ) - tdSql.query( "select * from cars" ) - tdSql.checkRows( 1 ) - + tdLog.info(sql) + tdSql.execute(sql) + tdSql.query("select * from cars") + tdSql.checkRows(1) def run(self): self.checkTagBoundaries() @@ -151,7 +144,6 @@ class TDTestCase: self.checkTableNameBoundaries() self.checkRowBoundaries() - def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__) diff --git a/tests/pytest/table/column_name.py b/tests/pytest/table/column_name.py index aa958fd60c..a180d3f752 100644 --- a/tests/pytest/table/column_name.py +++ b/tests/pytest/table/column_name.py @@ -10,9 +10,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/table/column_num.py b/tests/pytest/table/column_num.py index 877f0409dc..3abedb083c 100644 --- a/tests/pytest/table/column_num.py +++ b/tests/pytest/table/column_num.py @@ -8,9 +8,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/table/create-a-lot.py b/tests/pytest/table/create-a-lot.py new file mode 100644 index 0000000000..7db4a8eaca --- /dev/null +++ b/tests/pytest/table/create-a-lot.py @@ -0,0 +1,45 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import taos +from util.log import tdLog +from util.cases import tdCases +from util.sql import tdSql + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + tdSql.prepare() + + print("==============step1") + print("prepare data") + + for x in range(0, 1000000): + tb_name = "tb%d" % x + tdLog.info("create table %s (ts timestamp, i int)" % tb_name) + tdSql.execute("create table %s (ts timestamp, i int)" % tb_name) + tdLog.info("insert into %s values(now, 1)" % tb_name) + tdSql.execute("insert into %s values(now, 1)" % tb_name) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/table/create.py b/tests/pytest/table/create.py index b456b444f4..8fedd4e920 100644 --- a/tests/pytest/table/create.py +++ b/tests/pytest/table/create.py @@ -19,9 +19,9 @@ from util.sql import tdSql class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/table/db_table.py b/tests/pytest/table/db_table.py index d4a8568375..5ead829e26 100644 --- a/tests/pytest/table/db_table.py +++ b/tests/pytest/table/db_table.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/table/del_stable.py b/tests/pytest/table/del_stable.py index 3932f32536..e7fd0f1fb1 100644 --- a/tests/pytest/table/del_stable.py +++ b/tests/pytest/table/del_stable.py @@ -19,9 +19,9 @@ from util.sql import tdSql class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/table/tablename-boundary.py b/tests/pytest/table/tablename-boundary.py index 335073065c..ce843c3fe7 100644 --- a/tests/pytest/table/tablename-boundary.py +++ b/tests/pytest/table/tablename-boundary.py @@ -10,9 +10,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/tag_lite/3.py b/tests/pytest/tag_lite/3.py index e5b5ba05e0..68d2e6c5ba 100644 --- a/tests/pytest/tag_lite/3.py +++ b/tests/pytest/tag_lite/3.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/tag_lite/4.py b/tests/pytest/tag_lite/4.py index 2b5b69a965..66641f9dfe 100644 --- a/tests/pytest/tag_lite/4.py +++ b/tests/pytest/tag_lite/4.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/tag_lite/5.py b/tests/pytest/tag_lite/5.py index 66fc4b721c..6e94e692cd 100644 --- a/tests/pytest/tag_lite/5.py +++ b/tests/pytest/tag_lite/5.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/tag_lite/6.py b/tests/pytest/tag_lite/6.py index ca1058d51b..52f6fe1b37 100644 --- a/tests/pytest/tag_lite/6.py +++ b/tests/pytest/tag_lite/6.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/tag_lite/add.py b/tests/pytest/tag_lite/add.py index e9bc01afd2..e9e3675485 100644 --- a/tests/pytest/tag_lite/add.py +++ b/tests/pytest/tag_lite/add.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/tag_lite/bigint.py b/tests/pytest/tag_lite/bigint.py index 875633901c..77a161c5bc 100644 --- a/tests/pytest/tag_lite/bigint.py +++ b/tests/pytest/tag_lite/bigint.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/tag_lite/binary.py b/tests/pytest/tag_lite/binary.py index 476d9e4062..543b00b34e 100644 --- a/tests/pytest/tag_lite/binary.py +++ b/tests/pytest/tag_lite/binary.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/tag_lite/binary_binary.py b/tests/pytest/tag_lite/binary_binary.py index e05f7e3d0e..c0d1c0bfe7 100644 --- a/tests/pytest/tag_lite/binary_binary.py +++ b/tests/pytest/tag_lite/binary_binary.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/tag_lite/bool.py b/tests/pytest/tag_lite/bool.py index e8b00ce4d9..c43d5b2ee5 100644 --- a/tests/pytest/tag_lite/bool.py +++ b/tests/pytest/tag_lite/bool.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/tag_lite/bool_binary.py b/tests/pytest/tag_lite/bool_binary.py index 7df7ba8c03..7105cc4e78 100644 --- a/tests/pytest/tag_lite/bool_binary.py +++ b/tests/pytest/tag_lite/bool_binary.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/tag_lite/bool_int.py b/tests/pytest/tag_lite/bool_int.py index 9706cca945..b7504b1127 100644 --- a/tests/pytest/tag_lite/bool_int.py +++ b/tests/pytest/tag_lite/bool_int.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/tag_lite/change.py b/tests/pytest/tag_lite/change.py index ab2c80485b..e1df901d5b 100644 --- a/tests/pytest/tag_lite/change.py +++ b/tests/pytest/tag_lite/change.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/tag_lite/column.py b/tests/pytest/tag_lite/column.py index 6b2285794d..4669f74498 100644 --- a/tests/pytest/tag_lite/column.py +++ b/tests/pytest/tag_lite/column.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/tag_lite/commit.py b/tests/pytest/tag_lite/commit.py index 4070ebd368..4ad2ecf8f9 100644 --- a/tests/pytest/tag_lite/commit.py +++ b/tests/pytest/tag_lite/commit.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/tag_lite/create-tags-boundary.py b/tests/pytest/tag_lite/create-tags-boundary.py index e80f458f0c..b98ae627c2 100644 --- a/tests/pytest/tag_lite/create-tags-boundary.py +++ b/tests/pytest/tag_lite/create-tags-boundary.py @@ -19,9 +19,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/tag_lite/create.py b/tests/pytest/tag_lite/create.py index 446f8fd38e..39a2d83a31 100644 --- a/tests/pytest/tag_lite/create.py +++ b/tests/pytest/tag_lite/create.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/tag_lite/datatype-without-alter.py b/tests/pytest/tag_lite/datatype-without-alter.py index 1a8d05d648..42bc42bdbf 100644 --- a/tests/pytest/tag_lite/datatype-without-alter.py +++ b/tests/pytest/tag_lite/datatype-without-alter.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 10 diff --git a/tests/pytest/tag_lite/datatype.py b/tests/pytest/tag_lite/datatype.py index 1fcf7ce19e..bc99cf74b0 100644 --- a/tests/pytest/tag_lite/datatype.py +++ b/tests/pytest/tag_lite/datatype.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 10 diff --git a/tests/pytest/tag_lite/delete.py b/tests/pytest/tag_lite/delete.py index 34fe6e6f51..d4a55a4a75 100644 --- a/tests/pytest/tag_lite/delete.py +++ b/tests/pytest/tag_lite/delete.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/tag_lite/double.py b/tests/pytest/tag_lite/double.py index 92e7d23677..f70c6871af 100644 --- a/tests/pytest/tag_lite/double.py +++ b/tests/pytest/tag_lite/double.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/tag_lite/filter.py b/tests/pytest/tag_lite/filter.py index b726e7646e..cdba8964ef 100644 --- a/tests/pytest/tag_lite/filter.py +++ b/tests/pytest/tag_lite/filter.py @@ -18,9 +18,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/tag_lite/float.py b/tests/pytest/tag_lite/float.py index 19140abe13..1bfb1ac94d 100644 --- a/tests/pytest/tag_lite/float.py +++ b/tests/pytest/tag_lite/float.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/tag_lite/int.py b/tests/pytest/tag_lite/int.py index 769e6009c8..b831244790 100644 --- a/tests/pytest/tag_lite/int.py +++ b/tests/pytest/tag_lite/int.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/tag_lite/int_binary.py b/tests/pytest/tag_lite/int_binary.py index 2f3f818cd2..62d8f2a604 100644 --- a/tests/pytest/tag_lite/int_binary.py +++ b/tests/pytest/tag_lite/int_binary.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/tag_lite/int_float.py b/tests/pytest/tag_lite/int_float.py index 4171085ad7..8a544c6110 100644 --- a/tests/pytest/tag_lite/int_float.py +++ b/tests/pytest/tag_lite/int_float.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/tag_lite/set.py b/tests/pytest/tag_lite/set.py index 6e1a5aed9d..44f5a0890d 100644 --- a/tests/pytest/tag_lite/set.py +++ b/tests/pytest/tag_lite/set.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/tag_lite/smallint.py b/tests/pytest/tag_lite/smallint.py index 324deb3632..a047b0afee 100644 --- a/tests/pytest/tag_lite/smallint.py +++ b/tests/pytest/tag_lite/smallint.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/tag_lite/tinyint.py b/tests/pytest/tag_lite/tinyint.py index 9406f0b6c7..6e1820713c 100644 --- a/tests/pytest/tag_lite/tinyint.py +++ b/tests/pytest/tag_lite/tinyint.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/test.py b/tests/pytest/test.py index 86417ea931..5b35563e1b 100644 --- a/tests/pytest/test.py +++ b/tests/pytest/test.py @@ -31,9 +31,10 @@ if __name__ == "__main__": masterIp = "" testCluster = False valgrind = 0 + logSql = True stop = 0 - opts, args = getopt.gnu_getopt(sys.argv[1:], 'f:p:m:scgh', [ - 'file=', 'path=', 'master', 'stop', 'cluster', 'valgrind', 'help']) + opts, args = getopt.gnu_getopt(sys.argv[1:], 'f:p:m:l:scgh', [ + 'file=', 'path=', 'master', 'logSql', 'stop', 'cluster', 'valgrind', 'help']) for key, value in opts: if key in ['-h', '--help']: tdLog.printNoPrefix( @@ -41,8 +42,10 @@ if __name__ == "__main__": tdLog.printNoPrefix('-f Name of test case file written by Python') tdLog.printNoPrefix('-p Deploy Path for Simulator') tdLog.printNoPrefix('-m Master Ip for Simulator') - tdLog.printNoPrefix('-c Test Cluster Flag') + tdLog.printNoPrefix('-l logSql Flag') tdLog.printNoPrefix('-s stop All dnodes') + tdLog.printNoPrefix('-c Test Cluster Flag') + tdLog.printNoPrefix('-g valgrind Test Flag') sys.exit(0) if key in ['-f', '--file']: @@ -54,6 +57,15 @@ if __name__ == "__main__": if key in ['-m', '--master']: masterIp = value + if key in ['-l', '--logSql']: + if (value.upper() == "TRUE"): + logSql = True + elif (value.upper() == "FALSE"): + logSql = False + else: + tdLog.printNoPrefix("logSql value %s is invalid" % logSql) + sys.exit(0) + if key in ['-c', '--cluster']: testCluster = True @@ -100,6 +112,8 @@ if __name__ == "__main__": tdLog.info("Procedures for tdengine deployed in %s" % (host)) + tdCases.logSql(logSql) + if testCluster: tdLog.info("Procedures for testing cluster") if fileName == "all": diff --git a/tests/pytest/user/pass_len.py b/tests/pytest/user/pass_len.py index 40bd1ca5fc..346b8424fe 100644 --- a/tests/pytest/user/pass_len.py +++ b/tests/pytest/user/pass_len.py @@ -19,9 +19,9 @@ from util.sql import tdSql class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): print("==============step1") diff --git a/tests/pytest/user/user_create.py b/tests/pytest/user/user_create.py index f8ac5c6799..a00f670a36 100644 --- a/tests/pytest/user/user_create.py +++ b/tests/pytest/user/user_create.py @@ -19,9 +19,9 @@ from util.sql import tdSql class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): print("==============step1") diff --git a/tests/pytest/util/cases.py b/tests/pytest/util/cases.py index f65b0dfde3..2fc1ac8515 100644 --- a/tests/pytest/util/cases.py +++ b/tests/pytest/util/cases.py @@ -24,6 +24,7 @@ class TDCase: def __init__(self, name, case): self.name = name self.case = case + self._logSql = True class TDCases: @@ -36,6 +37,9 @@ class TDCases: moduleName = fileName.replace(".py", "").replace("/", ".") return importlib.import_module(moduleName, package='..') + def logSql(self, logSql): + self._logSql = logSql + def addWindows(self, name, case): self.windowsCases.append(TDCase(name, case)) @@ -66,7 +70,7 @@ class TDCases: for tmp in self.linuxCases: if tmp.name.find(fileName) != -1: case = testModule.TDTestCase() - case.init(conn) + case.init(conn, self._logSql) try: case.run() except Exception as e: diff --git a/tests/pytest/util/sql.py b/tests/pytest/util/sql.py index eb53129722..245e4b0945 100644 --- a/tests/pytest/util/sql.py +++ b/tests/pytest/util/sql.py @@ -25,9 +25,15 @@ class TDSql: self.queryCols = 0 self.affectedRows = 0 - def init(self, cursor): + def init(self, cursor, log=True): self.cursor = cursor + if (log): + frame = inspect.stack()[1] + callerModule = inspect.getmodule(frame[0]) + callerFilename = callerModule.__file__ + self.cursor.log(callerFilename + ".sql") + def close(self): self.cursor.close() @@ -101,7 +107,6 @@ class TDSql: return self.cursor.istype(col, dataType) - def checkData(self, row, col, data): frame = inspect.stack()[1] callerModule = inspect.getmodule(frame[0]) -- GitLab