Re: plpython function with dictionary as function argument?

From: Peter Fein <pfein(at)pobox(dot)com>
To: gherzig(at)fmed(dot)uba(dot)ar
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: plpython function with dictionary as function argument?
Date: 2005-08-19 16:12:57
Message-ID: 43060509.1000408@pobox.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

gherzig(at)fmed(dot)uba(dot)ar wrote:
> Hi all. I need to know if it is possible to call a plpython stored funcion
> with an dictionary as single argument:
>
> Suppose this python structure:
>
> someDict = {
> 'field1': 'Foo',
> 'creepyfield': 'Bar'
> }
>
> The data base connection
> 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)")

Marshal someDict and unmarshal it in your function. Marshal is *very* fast.

--
Peter Fein pfein(at)pobox(dot)com 773-575-0694

Basically, if you're not a utopianist, you're a schmuck. -J. Feldman

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-08-19 16:27:31 Re: How to cancel a query if SIGINT does not work?
Previous Message Tony Caduto 2005-08-19 16:11:31 question about plpgsql replace function