python - cursor.fechtmany(size=cursor.arraysize) in Sqlite3 -
i want retrieve 100 first rows of sqlite3 database:
connection = sqlite3.connect('aktua.db') cursor = connection.cursor() print('actual \tcliente \thistórica') cursor.execute("select * referencias r_aktua '%k'").fetchmany(size=100) row in cursor: print('%s \t%s \t%s' % row) cursor.close() connection.close()
my code retrieves rows of database (+4000).
i've read sqlite3.cursor.fetchmany docs , sqlite python tutorial.
what's wrong?
use limit sql selection:
"select * referencias r_aktua '%k' limit 100"
or changue code to:
rows = cursor.execute("select * referencias r_aktua '%k'").fetchmany(size=100) row in rows: print('%s \t%s \t%s' % row)
Comments
Post a Comment