473,396 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 2630
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Marc Shapiro | last post by:
I am relatively new to python (I have used it on and off for a few small projects over the last few years) so I imagine that what I am trying to do has already been done, but practical experience,...
1
by: Steve | last post by:
I've searched throughout the python website and can't find an answer. My problem: After getting a BYTEA from a postgres database using Pygresql call: x = Db.query("SELECT seq FROM sequence \...
1
by: Steve | last post by:
Hi, I have postgres 7.4.1 running on my server and I've been trying to find a good python-postgres interface module. I installed Pygres on another machine running Linux using a RPM release and...
2
by: Ksenia Marasanova | last post by:
Hi, I wonder if anyone on this list is using Python as Postgres procedural language. I can't find a place for it i my mind. How would a typical MVC web application benefit from it (besides...
7
by: Abdul-Wahid Paterson | last post by:
Hi, I have had a site working for the last 2 years and have had no problems until at the weekend I replace my database server with a newer one. The database migration went like a dream and I had...
10
by: Hank | last post by:
We have just recently migrated the data from our Access 2000 backend to Postgres. All forms and reports seem to run correctly but, in many cases, very slowly. We do not want to switch over until...
7
by: Pankaj | last post by:
The module which i am creating is like Part A: 1. It does some processing by using python code. 2. The result of this python code execution is written to a text file. ] Part B: 1. I read a...
0
by: NM | last post by:
Hello, I've got a problem inserting binary objects into the postgres database. I have binary objects (e.g. images or smth else) of any size which I want to insert into the database. Funny is it...
4
by: Alchemist | last post by:
I am using Python 2.4 and Postgresql 8.2 database server. On the database I have created a stored function, example, CREATE OR REPLACE FUNCTION calculateaverage() I created a new python script...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.