Thread: [SOT] pypgsql function receiving dictionary as parameter?

[SOT] pypgsql function receiving dictionary as parameter?

From
gherzig@fmed.uba.ar
Date:
Hi all. Im a python programer, and im trying to use a dictionary
(associative array on Perl) in my pypgsql function without result. Anybody
know if it is possible?

Thanks a lot folks.
-- 
Gerardo Herzig
Direccion General de Organizacion y Sistemas
Facultad de Medicina
U.B.A.


Re: [SOT] pypgsql function receiving dictionary as parameter?

From
Michael Fuhr
Date:
On Fri, Aug 19, 2005 at 10:13:20AM -0300, gherzig@fmed.uba.ar wrote:
> Hi all. Im a python programer, and im trying to use a dictionary
> (associative array on Perl) in my pypgsql function without result. Anybody
> know if it is possible?

Please show a minimal but complete example of what you're trying to do.

BTW, pgsql-sql is supposed to be for SQL-related matters; this thread
would be more appropriate in pgsql-general or pgsql-interfaces.

-- 
Michael Fuhr


Re: [SOT] pypgsql function receiving dictionary as parameter?

From
gherzig@fmed.uba.ar
Date:
Suppose this python structure:

someDict = {           'field1': 'Foo',           'creepyfield': 'Bar'           }

and the connection to the database
CONN = pg.connect()....

I want some pypgslq function

CREATE myfunction ( __dictionary__) returns void
AS
.... (process)
LANGUAGE pythonu

and (the desired goal) be able to execute
CONN.execute("select * from myfunction (someDict)")

Thanks again, and yes, i might post to the others postgres list too.

-- 
Gerardo Herzig
Direccion General de Organizacion y Sistemas
Facultad de Medicina
U.B.A.
> On Fri, Aug 19, 2005 at 10:13:20AM -0300, gherzig@fmed.uba.ar wrote:
>> Hi all. Im a python programer, and im trying to use a dictionary
>> (associative array on Perl) in my pypgsql function without result.
>> Anybody
>> know if it is possible?
>
> Please show a minimal but complete example of what you're trying to do.
>
> BTW, pgsql-sql is supposed to be for SQL-related matters; this thread
> would be more appropriate in pgsql-general or pgsql-interfaces.
>
> --
> Michael Fuhr
>
>