test: insert into table from csv file
This commit is contained in:
parent
922766c145
commit
a5bafca5fb
|
@ -443,6 +443,7 @@
|
|||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/InsertFuturets.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/insert_wide_column.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/insert_column_value.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/insert_from_csv.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k_benchmark.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k.py -R
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
import taos
|
||||
import sys
|
||||
import datetime
|
||||
import inspect
|
||||
import random
|
||||
from util.dnodes import TDDnode
|
||||
from util.dnodes import tdDnodes
|
||||
|
||||
from util.log import *
|
||||
from util.sql import *
|
||||
from util.cases import *
|
||||
|
||||
class TDTestCase:
|
||||
def init(self, conn, logSql, replicaVar=1):
|
||||
self.replicaVar = int(replicaVar)
|
||||
tdLog.debug(f"start to excute {__file__}")
|
||||
tdSql.init(conn.cursor(), True)
|
||||
|
||||
self.testcasePath = os.path.split(__file__)[0]
|
||||
self.testcasePath = self.testcasePath.replace('\\', '//')
|
||||
self.database = "test_insert_csv_db"
|
||||
self.table = "test_insert_csv_tbl"
|
||||
|
||||
def insert_from_csv(self):
|
||||
tdSql.execute(f"drop database if exists {self.database}")
|
||||
tdSql.execute(f"create database {self.database}")
|
||||
tdSql.execute(f"use {self.database}")
|
||||
tdSql.execute(f"create table {self.table} (ts timestamp, c1 nchar(16), c2 double, c3 int)")
|
||||
tdSql.execute(f"insert into {self.table} file '{self.testcasePath}//test_insert_from_csv.csv'")
|
||||
tdSql.query(f"select count(*) from {self.table}")
|
||||
tdSql.checkData(0, 0, 5)
|
||||
|
||||
def run(self):
|
||||
tdSql.prepare()
|
||||
|
||||
startTime_all = time.time()
|
||||
self.insert_from_csv()
|
||||
endTime_all = time.time()
|
||||
print("total time %ds" % (endTime_all - startTime_all))
|
||||
|
||||
def stop(self):
|
||||
tdSql.close()
|
||||
tdLog.success("%s successfully executed" % __file__)
|
||||
|
||||
|
||||
tdCases.addWindows(__file__, TDTestCase())
|
||||
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -0,0 +1,5 @@
|
|||
'2024-12-13 09:30:00.050','ABCDEF68',24.774736842805263,200
|
||||
'2024-12-13 09:30:00.060','ABCDEF68',24.774736842805263,201
|
||||
'2024-12-13 09:30:00.080','ABCDEF68',24.774736842805263,202
|
||||
'2024-12-13 09:30:00.100','ABCDEF68',24.774736842805263,203
|
||||
'2024-12-13 09:30:00.110','ABCDEF68',24.774736842805263,204
|
|
|
@ -13,6 +13,7 @@ python3 .\test.py -f 0-others\cachemodel.py
|
|||
@REM python3 .\test.py -f 0-others\fsync.py
|
||||
|
||||
python3 .\test.py -f 1-insert\influxdb_line_taosc_insert.py
|
||||
python3 .\test.py -f 1-insert\insert_from_csv.py
|
||||
@REM python3 .\test.py -f 1-insert\opentsdb_telnet_line_taosc_insert.py
|
||||
@REM python3 .\test.py -f 1-insert\opentsdb_json_taosc_insert.py
|
||||
@REM #python3 .\test.py -f 1-insert\test_stmt_muti_insert_query.py
|
||||
|
|
Loading…
Reference in New Issue