Re: [HACKERS] PL/Python: Add cursor and execute methods to plan object - Mailing list pgsql-hackers

From David Steele
Subject Re: [HACKERS] PL/Python: Add cursor and execute methods to plan object
Date
Msg-id 6a9b4e5b-59ea-7975-8829-9433e3f7e647@pgmasters.net
Whole thread Raw
In response to [HACKERS] PL/Python: Add cursor and execute methods to plan object  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Responses Re: [HACKERS] PL/Python: Add cursor and execute methods to planobject  (Andrew Dunstan <andrew.dunstan@2ndquadrant.com>)
List pgsql-hackers
On 2/25/17 1:27 PM, Peter Eisentraut wrote:
> Something that has been bothering me in PL/Python for a long time is the
> non-object-oriented way in which plans are prepared and executed:
> 
>     plan = plpy.prepare(...)
>     res = plpy.execute(plan, ...)
> 
> where plpy.execute() takes either a plan or a query string.
> 
> I think a better style would be
> 
>     plan = plpy.prepare(...)
>     res = plan.execute(...)
> 
> so that the "plan" is more like a statement handle that one finds in
> other APIs.
> 
> This ended up being very easy to implement, so I'm proposing to allow
> this new syntax as an alternative.
> 
> I came across this again as I was developing the background sessions API
> for PL/Python.  So I'm also wondering here which style people prefer so
> I can implement it there.

This patch applies cleanly at cccbdde.

Any Python folks out there who would like to take a crack at reviewing this?

-- 
-David
david@pgmasters.net



pgsql-hackers by date:

Previous
From: David Steele
Date:
Subject: [HACKERS] Re: [BUGS] Problem in using pgbench's --connect(-C) and--rate=rate(-R rate) options together.
Next
From: Andres Freund
Date:
Subject: Re: [HACKERS] Size vs size_t