给出一个wordpress4.0的MySQL数据库。我正在数据库上运行以下查询:
conn = pymysql.connect(host='localhost', port=3306, user='root', passwd='geheim', db='mysite')
cur = conn.cursor()
cur1 = conn.cursor()
cur.execute("select table_name,column_name from information_schema.columns where table_schema = 'mysite' order by table_name,ordinal_position")
tables=Set()
columns=Set()
for r in cur.fetchall():
cur1.execute("select " + r[1] + " from " + r[0] )
for s in cur1.fetchall():
print r[0],r[1],s
tables.add(r[0])
columns.add(r[1])
print tables
for t in tables:
print t # to find out in which table the request crashes
cur1.execute("SELECT table_name,column_name FROM information_schema WHERE table_name='\" + `t` + \"'\"")
for r in cur1.fetchall():
print r
当我在ipython笔记本中运行这些代码时(也可以作为python运行文件.py在DOS命令行上)我在请求的末尾收到一个错误:
^{pr2}$我看不出有什么明显的理由可以让这个请求在这个时候退出。当我稍微改变输出量时,该命令会在其他表中退出。此时,输出已达到约800KB和11000行。在
这可能是一个大规模的问题。pymysql中的bug?我可以编写一个MySQL函数并尝试直接在MySQL中执行,但我不擅长编写MySQL函数或过程。有人能给我一个开始吗?谢谢。在
目前没有回答
相关问题 更多 >
编程相关推荐