Jaymon / prom

A PostgreSQL or SQLite orm for Python
MIT License
22 stars 4 forks source link

Moving through rows using pk or limit/offset #23

Closed Jaymon closed 3 years ago

Jaymon commented 8 years ago

This was a way rough test but there didn't seem to be any meaningful difference between the two

with pout.p("cursor"):
    user_id = 0
    while True:
        users = User.query.gt_pk(user_id).asc_pk().get(5000)
        if users:
            for u in users:
                user_id = u.pk
                print user_id
        else:
            break

with pout.p("all"):
    for u in User.query.asc_pk().all():
        user_id = u.pk
        print user_id
Jaymon commented 3 years ago

The new Iterator code that uses cursors exclusively makes this moot