Re: [HACKERS] PL/Python result metadata

2012-01-26 Thread Abhijit Menon-Sen
At 2012-01-11 22:05:34 +0200, pete...@gmx.net wrote: > > I propose to add two functions to the result object: > > .colnames() returns a list of column names (strings) > .coltypes() returns a list of type OIDs (integers) […] > > Patch attached. Comments welcome. Applies, builds, passes tests. Co

Re: [HACKERS] PL/Python result metadata

2012-01-16 Thread Dimitri Fontaine
Peter Eisentraut writes: > I deliberately chose not to do that, because the PL/Python API is > intentionally totally different from the standard DB-API, and mixing in > some semi-conforming look-alike would be quite confusing from both ends. Fair enough. > I think we should stick with the PL/Pyt

Re: [HACKERS] PL/Python result metadata

2012-01-16 Thread Peter Eisentraut
On ons, 2012-01-11 at 22:52 +0100, Dimitri Fontaine wrote: > Peter Eisentraut writes: > > .colnames() returns a list of column names (strings) > > .coltypes() returns a list of type OIDs (integers) > > > > I just made that up because there is no guidance in the other standard > > PLs for this sort

Re: [HACKERS] PL/Python result metadata

2012-01-16 Thread Peter Eisentraut
On ons, 2012-01-11 at 17:16 -0300, Alvaro Herrera wrote: > > I propose to add two functions to the result object: > > > > .colnames() returns a list of column names (strings) > > .coltypes() returns a list of type OIDs (integers) > > No typmods? Didn't think about that, but could be added using

Re: [HACKERS] PL/Python result metadata

2012-01-11 Thread Jan Urbański
On 11/01/12 22:52, Dimitri Fontaine wrote: > Peter Eisentraut writes: >> .colnames() returns a list of column names (strings) >> .coltypes() returns a list of type OIDs (integers) >> >> I just made that up because there is no guidance in the other standard >> PLs for this sort of thing, AFAICT. >

Re: [HACKERS] PL/Python result metadata

2012-01-11 Thread Dimitri Fontaine
Peter Eisentraut writes: > .colnames() returns a list of column names (strings) > .coltypes() returns a list of type OIDs (integers) > > I just made that up because there is no guidance in the other standard > PLs for this sort of thing, AFAICT. What about having the same or comparable API as in

Re: [HACKERS] PL/Python result metadata

2012-01-11 Thread Alvaro Herrera
Excerpts from Peter Eisentraut's message of mié ene 11 17:05:34 -0300 2012: > There is currently no reliable way to retrieve from a result object in > PL/Python the number, name, or type of the result columns. You can get > the number and name if the query returned more than zero rows by looking

[HACKERS] PL/Python result metadata

2012-01-11 Thread Peter Eisentraut
There is currently no reliable way to retrieve from a result object in PL/Python the number, name, or type of the result columns. You can get the number and name if the query returned more than zero rows by looking at the row dicts, but that is unreliable. The type information isn't available at