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. Ad

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 Patch attached for review. Here is a review: This patch adds a function that pl/python functions can call to convert a query result hash into a string suitable

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

2013-01-08 Thread Peter Eisentraut
On 1/8/13 11:55 AM, Daniele Varrazzo wrote: >>> >> '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. There is no guideline for how str should look like when it's n

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 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 rows shown a

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.

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 wrote: > On Tue, Jan 8, 2013 at 3:58 AM, Peter Eisentraut 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 >> >> >> >

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 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 > > > > By implementing a "str" handler for the result object, it now print

[HACKERS] PL/Python result object str handler

2013-01-07 Thread Peter Eisentraut
For debugging PL/Python functions, I'm often tempted to write something like rv = plpy.execute(...) plpy.info(rv) which prints something unhelpful like By implementing a "str" handler for the result object, it now prints something like Patch attached for review. diff --git a/src/pl/plpytho