国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術文章
文章詳情頁

python sqlite3 長語句插入出錯

瀏覽:164日期:2022-06-26 15:20:42

問題描述

python使用sqlite3 長語句插入出錯Python2.7下面是源碼,還有測試結果,原原本本在終端操作是沒問題的,但是在python中跑就出bug了

import xlrdimport multiprocessingfrom sql import sql_methodmysqlite=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 querydata=mysqlite.conn.execute(query)for i in data: print itable_compare()

Ran 1 test in 0.000s

FAILED (errors=1)

ErrorTraceback (most recent call last): File 'C:Python27libunittestcase.py', line 329, in run testMethod() File 'C:Python27libunittestloader.py', line 32, in testFailure raise exceptionImportError: Failed to import test module: testTraceback (most recent call last): File 'C:Python27libunittestloader.py', line 254, in _find_tests module = self._get_module_from_name(name) File 'C:Python27libunittestloader.py', line 232, in _get_module_from_name __import__(name) File 'E:pythonexcel_pythontest.py', line 14, in <module> table_compare() File 'E:pythonexcel_pythontest.py', line 11, in table_compare data=mysqlite.conn.execute(query)OperationalError: near ',': syntax error

原原本本的輸入到終端沒有任何問題

問題解答

回答1:

你的SQL寫得有問題

sql = '''select *FROM compare_sales_order aWHERE not exists (SELECT 1FROM sales_order bwhere a.order_num=b.order_num and a.product_name=b.product_name and a.col_color=b.col_color )'''

標簽: Python 編程
相關文章:
主站蜘蛛池模板: 河曲县| 当涂县| 宜昌市| 余庆县| 安乡县| 萍乡市| 岚皋县| 筠连县| 社旗县| 隆尧县| 沁水县| 万安县| 河东区| 黄冈市| 玉门市| 西平县| 齐齐哈尔市| 东阿县| 郧西县| 嘉峪关市| 桐柏县| 离岛区| 闻喜县| 马边| 土默特左旗| 江北区| 黔西县| 天门市| 教育| 句容市| 永安市| 新民市| 开远市| 灵璧县| 衡南县| 津市市| 谢通门县| 崇左市| 搜索| 伽师县| 萝北县|