mysql和sqlite3多次查询问题,搞了几次没搞定
import time
import urllib.request
import urllib.parse
import sqlite3
import pymysql
if __name__ == "__main__":
connmysql = pymysql.connect(user='root', password='123456', database='empiredd', charset='utf8')
cursormysql = connmysql.cursor()
query = 'select id, title , company, qikanname from table1'
cursormysql.execute(query)
for (id, title, company, qikanname) in cursormysql:
print(id, title, company, qikanname)
conn = sqlite3.connect(r"E:\网站\SpiderResult.db3")
cursor = conn.cursor()
sql = "select filename from table3 where biaoti = ? and company = ? and kanwu = ?"
cursor.execute(sql, (title, company, qikanname))
values = cursor.fetchone()
print(values[0])
print(id)
cursormysql.execute('update table2 set downpath = ? where id = ?', (values[0], id))
connmysql.commit()
cursor.close()
conn.close()
cursormysql.close()
connmysql.close()
错误提示是cursormysql.execute('update table2 set downpath = ? where id = ?', (values[0], id)),很奇怪
相关推荐
sqlite3迁移mysql可能遇到的问题集合
主要给大家介绍了关于sqlite3迁移mysql可能遇到的问题集合,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面来一起学习学习吧
sqlite3-to-mysql:使Sqlite3导出MySQL可读
sqlite3-to-mysql:使Sqlite3导出MySQL可读
将sqlite3中数据导入到mysql中的实战教程
最近因为工作的需求,需要将sqlite3中的数据导入到mysql中去,发现网上的一些教程都不够详细,索性自己写一篇,下面这篇文章主要给大家介绍了关于将sqlite3数据库中的数据导入到mysql数据库中的相关资料,需要的朋友可以参考下。
sqlite3.exe
sqlite3.exe是款强大的轻型数据库管理系统,它的设计目标是嵌入式的,目前在很多嵌入式产品中使用了它,占用资源低,支持Windows/Linux/Unix等等主流的操作系统,同时能跟很多程序语言相结合,如java,python,nodejs,同样比起Mysql、PostgreSQL这两款开源世界着名的数据库管理系统来讲,它的处理速度比他们都快。 sqlite3命令提速调试方法 在调试Android上层系统时,经常需要改动到跟数据库相关的参数,光有SQL语句使用知识毫无用处,好在Android命令行下有sqlite3命令,而现在系统的应用会把数据保存到/data/data/包名/database/目录下,该目录下会有.db扩展名的数据库文件,关于该命令的使用如下例: 1、打开指定数据库: sqlite3 /data/data/com.android.providers.settings/databases/settings.db 2、打开数据库后进入sqlite>命令行,可以使用.help查看可用指令了,也可以使用标准的SQL语句进行调试使用如update
Ubuntu安装mysql和sqlite3
Ubuntu安装mysql和sqlite3,里边详细讲解了安装的过程,一步一步的教你怎么安装mysql及sqlite3


