diff --git a/dbConn.py b/dbConn.py index e2912af..6d46723 100644 --- a/dbConn.py +++ b/dbConn.py @@ -46,33 +46,14 @@ print(e) # 写入板块分类表 - def save_bankuai_table(self, data, cate): + def save_bankuai_table(self, data): cursor = self.db.cursor() - # cursor.execute('DROP TABLE IF EXISTS t_bankuai') - # - # sql = ''' - # CREATE TABLE `t_bankuai` ( - # `id` int(11) NOT NULL AUTO_INCREMENT, - # `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '板块代码', - # `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '板块名称', - # `cate` int(1) DEFAULT NULL COMMENT '1-地域 2-行业 3-概念', - # PRIMARY KEY (`id`) - # ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; - # ''' - try: - # 创建表 - # cursor.execute(sql) for i in data: - code = str(i['f12']) - name = str(i['f14']) - - sql = "INSERT INTO `t_bankuai`(`code`, `name`, `cate`) VALUES ('%s', '%s', %s)" % (code, name, cate) - - cursor.execute(sql) + cursor.execute(i) self.db.commit()