简单的写法:

import records 

db = records.Database('sqlite:///test.db')
rows = db.query('select * from log')
print (rows.all())

然后报错Cannot operate on a closed database,怎么修改:

import records 

db = records.Database('sqlite:///test.db')
conn = db.get_connection()

rows = conn.query('select * from log')
print (rows.all())

文章来源于互联网,如有雷同请联系站长删除:Python使用records库查询sqlite数据库表报错Cannot operate on a closed database

发表评论