Re: [HACKERS] PL/Python result object str handler

2013-02-02 Thread Steve Singer
On 13-01-07 09:58 PM, Peter Eisentraut wrote: By implementing a str handler for the result object, it now prints something like PLyResult status=5 nrows=2 rows=[{'foo': 1, 'bar': '11'}, {'foo': 2, 'bar': '22'}] Patch attached for review. Here is a review: This patch adds a function that

Re: [HACKERS] PL/Python result object str handler

2013-02-02 Thread Peter Eisentraut
On Sat, 2013-02-02 at 15:43 -0500, Steve Singer wrote: I've looked through the code and everything looks fine. The patch includes no documentation. Adding a few lines to the Utility Functions section of the plpython documentation so people know about this feature would be good. Added

Re: [HACKERS] PL/Python result object str handler

2013-01-08 Thread Magnus Hagander
On Tue, Jan 8, 2013 at 3:58 AM, Peter Eisentraut pete...@gmx.net wrote: For debugging PL/Python functions, I'm often tempted to write something like rv = plpy.execute(...) plpy.info(rv) which prints something unhelpful like PLyResult object at 0xb461d8d8 By implementing a str handler

Re: [HACKERS] PL/Python result object str handler

2013-01-08 Thread Daniele Varrazzo
On Tue, Jan 8, 2013 at 9:32 AM, Magnus Hagander mag...@hagander.net wrote: On Tue, Jan 8, 2013 at 3:58 AM, Peter Eisentraut pete...@gmx.net wrote: For debugging PL/Python functions, I'm often tempted to write something like rv = plpy.execute(...) plpy.info(rv) which prints something

Re: [HACKERS] PL/Python result object str handler

2013-01-08 Thread Peter Eisentraut
On 1/8/13 4:32 AM, Magnus Hagander wrote: How does it work if there are many rows in there? Say the result contains 10,000 rows - will the string contain all of them? If so, might it be worthwhile to cap the number of rows shown and then follow with a ... or something? I don't think so. Any

Re: [HACKERS] PL/Python result object str handler

2013-01-08 Thread Magnus Hagander
On Tue, Jan 8, 2013 at 10:23 PM, Peter Eisentraut pete...@gmx.net wrote: On 1/8/13 4:32 AM, Magnus Hagander wrote: How does it work if there are many rows in there? Say the result contains 10,000 rows - will the string contain all of them? If so, might it be worthwhile to cap the number of

Re: [HACKERS] PL/Python result object str handler

2013-01-08 Thread Peter Eisentraut
On 1/8/13 11:55 AM, Daniele Varrazzo wrote: PLyResult status=5 nrows=2 rows=[{'foo': 1, 'bar': '11'}, {'foo': 2, 'bar': '22'}] This looks more a repr-style format to me (if you implement repr but not str, the latter will default to the former). The repr style was the only guideline I found.