Alternative to Pythons SQLite3 module - maybe MySQL
We have a website that uses SQL (currently SQLite3) to store entrants into a competition & the server side language is python & uses the module sqlite3. It turns out that the webhost runs python 2.4 & the module sqlite3 is only available in python 2.6/2,7 & up.
So I need to be able to write competi开发者_StackOverflow中文版tion entrants to my SQL database in python using only python 2.4.
It would be great if I could get SSH access & install python 2.7 but ofcourse this webhost wants our business to purchase VPS access to do this & this is not possible.
I have read that I could import python SQL modules using the following code but it fails when I run this script on the website(in the CGI-bin folder):
try:
import sqlite3
except ImportError:
from pysqlite import dbapi2 as sqlite3
I am thinking of just using MySQL because I have heard it is faster but is there a python MYSQL module & does it work on python 2.4? Do you have any advice on how I can write & store competition entries to my my SQL database in python 2.4?
Obviously you cannot use pysqlite when your webhost has not installed it. There are, of course, other libraries to access different databases, such as MySQL. If you can you those depends, again, on your webhost: He will have to install the respective database module.
Moreover, most SQL databases are standalone services that need to be installed and maintained separately.
Just ask you webhost which databases are available, if any.
By the way, "you heard MySQL is faster": For small databases this is probably wrong, as SQLite is pretty fast and might benefit from the fact that it can access data locally, whereas with MySQL, there will be some communication overhead.
精彩评论