当前位置:   article > 正文

python创建sqlite3 gbk错误_python sqlite3 长语句插入出错

failed to import test module: test_post

python使用sqlite3 长语句插入出错

Python2.7

下面是源码,还有测试结果,原原本本在终端操作是没问题的,但是在python中跑就出bug了

import xlrd

import multiprocessing

from sql import sql_method

mysqlite=sql_method()

def table_compare():

query='''select * FROM compare_sales_order WHERE ( compare_sales_order.order_num, compare_sales_order.product_name, compare_sales_order.col_color) not IN(SELECT order_num, product_name, col_color FROM sales_order) '''

# print query

data=mysqlite.conn.execute(query)

for i in data:

print i

table_compare()

Ran 1 test in 0.000s

FAILED (errors=1)

Error

Traceback (most recent call last):

File "C:\Python27\lib\unittest\case.py", line 329, in run

testMethod()

File "C:\Python27\lib\unittest\loader.py", line 32, in testFailure

raise exception

ImportError: Failed to import test module: test

Traceback (most recent call last):

File "C:\Python27\lib\unittest\loader.py", line 254, in _find_tests

module = self._get_module_from_name(name)

File "C:\Python27\lib\unittest\loader.py", line 232, in _get_module_from_name

__import__(name)

File "E:\python\excel_python\test.py", line 14, in

table_compare()

File "E:\python\excel_python\test.py", line 11, in table_compare

data=mysqlite.conn.execute(query)

OperationalError: near ",": syntax error

原原本本的输入到终端没有任何问题

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Monodyee/article/detail/480870?site
推荐阅读
相关标签
  

闽ICP备14008679号