473,395 Members | 1,689 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,395 software developers and data experts.

Postgres PL/Python

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 performance)?
I understand from the docs that Postgres 7.4 has PL/PythonU -
unlimited functionality. It sounds like I have the whole Python
available in Postgres. That means big parts of application logic can
be moved to stored procedures, and dummy SQL layer becomes something
else... sounds scary. Any opinions on this?

Thanks.

--
Ksenia
Sep 15 '05 #1
2 2548
Ksenia Marasanova <ks***************@gmail.com> writes:
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 performance)?
Your typical MVC web application hasn't got the foggiest about whether
the code that handles it's HTTP request is running in a stored
procedure or a client, and has no way of even finding out. So there's
no way they can "take advantage" of them.

At first glance, the performance difference is as likely to be
negative as it is to be positive, so avoid premature optimizations.
I understand from the docs that Postgres 7.4 has PL/PythonU -
unlimited functionality. It sounds like I have the whole Python
available in Postgres. That means big parts of application logic can
be moved to stored procedures, and dummy SQL layer becomes something
else... sounds scary. Any opinions on this?


Sounds like something that's good for your job security.

That you can now do stored procedures in Python shouldn't have any
effect on whether you decide to implement some function in your
application as a stored procedure or not. Unless there's something
really screwy about PL/Python, anyway.

Whether or not you use stored procedures is almost religious in
nature. Google for "stored procedures", and you'll find opinions
ranging from "never use them at all" to "use them whenever you
possibly can."

<mike
--
Mike Meyer <mw*@mired.org> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
Sep 16 '05 #2
Mike Meyer <mw*@mired.org> writes:
Whether or not you use stored procedures is almost religious in
nature. Google for "stored procedures", and you'll find opinions
ranging from "never use them at all" to "use them whenever you
possibly can."


Also there's the problem of performance. If you can write an SQL function
(that's how PostgreSQL calls its stored procedures) instead of a Python
function, chances are that the query analyzer will be able to do a better job
optimizing it than with Python.

From some talk on IRC with PostgreSQL people, I got the following impression
(in order of better performance to worse performance):

- C
- SQL
- plpgsql
- plpythonu

YMMV.
Ah! And I'm the one of "use them whenever you can" people. :-) It reduces a
lot of code and make system less prone to errors when you have multiple
interfaces (besides making it easier to fix / add database logic).
Be seeing you,
--
Jorge Godoy <go***@ieee.org>
Sep 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ravi | last post by:
Hi, I'm looking for a Postgres connection Python module that has good support for the BYTEA type. By good support I mean that -it should have a function to escape the raw binary data as...
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...
1
by: Roland Heiber | last post by:
Hi, i recently migrated from mysql to postgresql and did use severel python postgres-modules. All do what they are designed for, so which one would you use? psycopg, pygresql, pypgsql? psycopg...
3
by: Michael Lang | last post by:
Hi to all, can some one point me to the correct way, how to use PostgreSQLs "COPY" feature from within python ? What i want to do is: connect start transaction drop current tablecontens
4
by: Lynn.Tilby | last post by:
I just installed RH9 on a new machine and installed postgres in the installation process. I got the following error when trying to start the postmaster so... I tried removing the postgres software...
24
by: Henrik Steffen | last post by:
hello all, on my master-db-server i'm running postgres 7.4.1, and I have got two slave-servers running postgres 7.4.2 running the following query on the master-server (7.4.1) delivers: ...
3
by: Fuzzydave | last post by:
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...
9
by: Reid Priedhorsky | last post by:
Hi folks, I would like to access a remote Postgres server from a Python program in a secure way. Postgres doesn't currently listen to the Internet for connections, and I'd prefer to keep it that...
2
by: clearissues | last post by:
Hi All, I have a python script which takes dump of postgres and restores the same. When i take a dump there is no problem. command to take dump: pg_dump -b -c -C --format=c -d -h <<hostname>>...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.