光标.fechtmany(尺寸=光标.arraysize)在Sqlite3中

2024-10-03 04:32:25 发布

您现在位置:Python中文网/ 问答频道 /正文

我想检索Sqlite3数据库的前100行:

connection = sqlite3.connect('aktua.db')
cursor = connection.cursor()

print('Actual \tCliente \tHistórica')
cursor.execute("SELECT * FROM Referencias WHERE r_aktua LIKE '%K'").fetchmany(size=100)

for row in cursor:
    print('%s \t%s \t%s' % row)

cursor.close()
connection.close()

我的代码检索数据库的所有行(+4000)。
我读过sqlite3.Cursor.fetchmany Docs和{a2}。在

怎么了?在


Tags: 数据库closedbconnectconnectionsqlite3cursorrow