From: | Don Parris <parrisdc(at)gmail(dot)com> |
---|---|
To: | "psycopg(at)postgresql(dot)org" <psycopg(at)postgresql(dot)org> |
Subject: | Paging Through Query Result Sets |
Date: | 2013-04-19 22:38:32 |
Message-ID: | CAJ-7yonkNqPuuO3t5xMaUTpkgLR2Zw+P3M7h2kSB-BHj+whHXA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | psycopg |
Hi all,
I would like to be able to page through a result set when there is more
than one screenful of data. Is there a good example of paging through a
query result set in Bash - something like implementing the less command?
Even if I can't scroll backwards through the result set, at least being
able to control the paging forward would be good.
I have seen the notes on fetchmany(), which almost seems to be what I
want. Except that fetchmany(25) will fetch 25 records and that's about
it. Maybe I just need to change the way I code it...
Active State used to have some neat snippets I was able to take advantage
of in the past (for working with text files), and I was looking at this:
http://code.activestate.com/recipes/137270-use-generators-for-fetching-large-db-record-sets/
But I am not certain it really does what I am looking for. Still, I am
fairly certain there is an example of this somewhere I can look at to see
how it is implemented.
Thoughts?
--
D.C. Parris, FMP, Linux+, ESL Certificate
Minister, Security/FM Coordinator, Free Software Advocate
http://dcparris.net/
<https://www.xing.com/profile/Don_Parris><http://www.linkedin.com/in/dcparris>
GPG Key ID: F5E179BE
From | Date | Subject | |
---|---|---|---|
Next Message | Joe Abbate | 2013-04-19 22:55:42 | Re: Paging Through Query Result Sets |
Previous Message | Don Parris | 2013-04-19 21:35:51 | Re: Question on Multi-Table Inserts |