Re: PL/Python result object str handler
| От | Magnus Hagander |
|---|---|
| Тема | Re: PL/Python result object str handler |
| Дата | |
| Msg-id | CABUevEy8wiuO2uKz4BdaX12JSddokuSfxzE6dYE8moTgDBdsVg@mail.gmail.com обсуждение исходный текст |
| Ответ на | PL/Python result object str handler (Peter Eisentraut <peter_e@gmx.net>) |
| Ответы |
Re: PL/Python result object str handler
Re: PL/Python result object str handler |
| Список | pgsql-hackers |
On Tue, Jan 8, 2013 at 3:58 AM, Peter Eisentraut <peter_e@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 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.
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?
--Magnus HaganderMe: http://www.hagander.net/Work: http://www.redpill-linpro.com/
В списке pgsql-hackers по дате отправления: