感谢您阅读我的帖子。
我想做一件简单的事情:从一个数据库中获取信息并注入另一个数据库。
PRAGMA_fl_product = ACCESS_cursor.execute('SELECT Prekes.PrekeID, Prekes.NomNr, AmburiaSandLik.Likutis, Prekes.PardKaina, AmburiaSandLik.Likutis, Prekes.PardKaina FROM Prekes INNER JOIN AmburiaSandLik ON Prekes.PrekeID=AmburiaSandLik.PrekeID;').fetchall()
flproduct="INSERT INTO fl_product (product_id, model, quantity, prices, status) VALUES ('%s', '%s', '%s', '%s', '1') ON DUPLICATE KEY UPDATE quantity='%s', price='%s'"
SQLcursor.executemany(flproduct, PRAGMA_fl_product)
这会引发错误:
SQLcursor.executemany(flproduct, PRAGMA_fl_product)
File "C:\Program Files (x86)\Python 3.5\lib\site-packages\mysql\connector\cursor.py", line 606, in executemany
stmt = self._batch_insert(operation, seq_params)
File "C:\Program Files (x86)\Python 3.5\lib\site-packages\mysql\connector\cursor.py", line 553, in _batch_insert
"Not all parameters were used in the SQL statement")
mysql.connector.errors.ProgrammingError: Not all parameters were used in the SQL statement
有人可以帮助我了解我面临的问题吗?
我选择 6 列并尝试使用 6 个“%s”转义条目,但似乎遗漏了一些东西。