Oddbean new post about | logout
 And then you created a loop yourself with a conditional in it for when you reached the last object? 

Never used sqlite3 much with python, only to get some stats from my nostr-rs-relay. 
 Ah did not read the fetchmany somehow 🤦‍♂️ 
 i use sqlite3 a lot, it's great as application database--but in this case it's also for prying into nostr-rs-relay's database

yes, just fetchone in a loop usually

while True
    rec = cursor.fetchone()
    if rec is None: 
        break

which works the same i guess but it's more typing

if you're concerned about performance you'd also do this, but fetching a batch at the same time with fetchmany

there's also fetchall when you want to fetch everything, but don't expect so many it'd exhaust memory