creating a table in plpython?

Started by Celia McInnisabout 8 years ago3 messagesgeneral
Jump to latest
#1Celia McInnis
celia.mcinnis@gmail.com

Hi - Is it possible to create a table inside a plpython stored procedure?
If so, can you give an example of how to do so?

Many thanks,
Celia McInnis

#2David G. Johnston
david.g.johnston@gmail.com
In reply to: Celia McInnis (#1)
Re: creating a table in plpython?

On Wed, Jan 10, 2018 at 4:27 PM, Celia McInnis <celia.mcinnis@gmail.com>
wrote:

Hi - Is it possible to create a table inside a plpython stored procedure?
If so, can you give an example of how to do so?

​Haven't used pl/python myself but...​

https://www.postgresql.org/docs/10/static/plpython-database.html

so... plpy.execute("CREATE TABLE ...") ?

David J.

#3Celia McInnis
celia.mcinnis@gmail.com
In reply to: David G. Johnston (#2)
Re: creating a table in plpython?

Thanks - works like a charm. Hmmm. I tried that earlier and got errors. I
just retried and it worked fine this time. I guess I had some other problem
- It seems that sometimes I have to exit and reenter my psql session to use
a newly interpreted version of my stored procedure, so maybe that was part
of the problem...

On Wed, Jan 10, 2018 at 6:34 PM, David G. Johnston <
david.g.johnston@gmail.com> wrote:

Show quoted text

On Wed, Jan 10, 2018 at 4:27 PM, Celia McInnis <celia.mcinnis@gmail.com>
wrote:

Hi - Is it possible to create a table inside a plpython stored procedure?
If so, can you give an example of how to do so?

​Haven't used pl/python myself but...​

https://www.postgresql.org/docs/10/static/plpython-database.html

so... plpy.execute("CREATE TABLE ...") ?

David J.