469,645 Members | 1,559 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,645 developers. It's quick & easy.

Calling a Postgres Function using CGI written in Python

I need to call a function stored in Postgres which does a lot of the db
and calculation work
all the SQL queries are hardcoded in a file called cmi.py. What i need
to do is too to call
my function from postgres passing in my product_code variable into it
and returning the
value from the query into a variable i can print to screen as part of a
HTML page.

I am sure its very easy but have never done anything in python as have
none of the guys
i work with making this a bit of a problem.

Cheers Guys
David

May 3 '06 #1
3 2518
A quick google for "Python CGI" gives you lots of links. But if you
intend to do much in the way of cgi, then I would recommend the spyce
framework,http://spyce.sourceforge.net/

HTH

Colin
Fuzzydave wrote:
I need to call a function stored in Postgres which does a lot of the db
and calculation work
all the SQL queries are hardcoded in a file called cmi.py. What i need
to do is too to call
my function from postgres passing in my product_code variable into it
and returning the
value from the query into a variable i can print to screen as part of a
HTML page.

I am sure its very easy but have never done anything in python as have
none of the guys
i work with making this a bit of a problem.

Cheers Guys
David

May 3 '06 #2
I did do a google search i have looking through the one python book i
have
and there are plenty of references for how to write a function in
Python but
not as many on how to call a function stored in postgres using python I
have
tried the conn.execute(cmi_grn_cost(productCode)) and also the
conn.callproc(cmi_grn_cost(productCode)) commands where conn is the
connection object and cmi_grn_cost() is the the function getting called
from
Postgres and productCode is the variable to passed.

May 3 '06 #3
cheers :)

thats what i wanted to know :)

David

May 4 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Marc Shapiro | last post: by
1 post views Thread by Steve | last post: by
1 post views Thread by Steve | last post: by
2 posts views Thread by Ksenia Marasanova | last post: by
7 posts views Thread by Pankaj | last post: by
4 posts views Thread by Alchemist | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.