python and mysql

traficou

New Member
Messages
1
Reaction score
0
Points
0
Hello,

I'm interested in using pyhton scripts storing results in the mysql db. I have searched information about the mysqldb python module and it seems is not installed.

I've tried to import the module and it's confirmed.

Do you know if it is possible to install manually or include in the directory to import it?

Is there any other possibility to connect python with postgree db?
I don't want to use plain data files!!!!! xD

Thank you all.
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
It's certainly possible to install manually. The trick is finding a binary distribution of MySQLdb that works on your server. The official build of 1.2.3rc1 is for 32 bit processors, and the servers are 64 bit. Well, Lotus is, but the others should be as well.

Should you find or build a 64 bit Linux binary, install it to ~/lib/python. If it's in .egg format, rename the extension to .zip and extract the contents. Insert the following near the top of any script that needs to import a package in ~/lib/python:
Code:
import sys, os;

homelibdir = os.path.join(os.path.expanduser('~'), 'lib', 'python')
if homelibdir not in sys.path:
    sys.path.append(homelibdir)
Normally, I'd say to put the above in ~/.pythonrc.py and put "import user" into the scripts, but the import fails for me on Lotus.
 

arunproff

New Member
Messages
9
Reaction score
1
Points
0
For postgresql I would recommend psycopg2 - a postgresql library for python.

A 3rd alternative and one that is available as a built in module in python2.5+ is sqlite. Sqlite is a fairly robust lightweight SQL engine, while it does not have all the features of mysql or postgresql, it contains most of the commonly used functionality of sql databases. It is also fairly robust and fast.

http://docs.python.org/library/sqlite3.html
 
Top