Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

What is the package candidate or alternative for the python-pgsql (module) package in Ubuntu 11.10 ?

An error indicator that could help:

Error: You need to have the python-pgsql module installed to use this script. 'apt-get install python-pgsql' on debian.

UPDATE:

The davical-cmdlnutl version 1.2.0 works.

share|improve this question
    
The relevant change for 1.2.0 dropped python-pgsql and replaced it with python-pygresql, corresponding to a module pgdb in the python imports list. –  MvG Jul 9 '12 at 22:35
add comment

1 Answer

up vote 1 down vote accepted

Debian developers suggest either python-psycopg2 or python-pygresql. They have removed the package from their distribution, as has Ubuntu. There might be some code changes required to use the new packages. You might ask the author of the script you intend to use to adjust his code to those packages.

Adapting davical-cmdlnut to psycopg2

There should be a pretty straight-forward translation between pyPgSQL and psycopg2. The different handling of quoting is perhaps the most difficult to do among these.

Also note that psycopg2 developers advise strongy against the use of + to compose querys, which davical-cmdlnut does all over the place. That's the reason they have to do so much manual quoting, whereas psycopg2 would do all that automatically if parameters were passed their way.

share|improve this answer
    
python-pygresql should work, its in the repos. –  Thomas W. Jun 26 '12 at 20:21
    
@LordofTime: Both are in the repos, as the links indicate. The documents the Debian guys referred to indicate Psycopg as more powerful and more compliant with Python DB-API, so as long as its GNU license is no problem, it might be the better suggestion. –  MvG Jun 26 '12 at 21:10
    
@LordofTime: Both of these packages are not working for me! –  pl1nk Jun 26 '12 at 21:22
    
“Not working” as in “the script does not work out of the box with those”? As I said, you'll probably have to adjust it, or get it adjusted. The packages provide replacement functionality, but no drop-in compatible API. If the script uses Python DB API, then those modifications should be minimal, only at connection initiation. If it uses custom code, more work will be required. –  MvG Jun 26 '12 at 22:21
    
I like your answer :) –  pl1nk Jul 9 '12 at 21:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.