On 04/15/2012 06:17 AM, Bob McConnell wrote:
> sqlite is not included in either version of Python I have installed
> (2.5.2 and 3.1.1). I tried installing it after doing the parallel
> installation of 3.1.1, but it bound to the older version of Python. I
> don't know anything about either Python or sqlite, so I have no idea how
> to get them to work together.
I would almost bet money that your python installs *do* have sqlite
built-in and available. Even distributions such as Ubuntu Linux which
tends to break up the base install of python a bit so as to not require
thinks like tkinter (normally also 'built-in' to python) for server
installs, include sqlite by default. My understanding is that it
(sqlite) is used for a lot of small data stores when something slightly
more than a pickle or shelve is needed.
Fire up the python interpreter of your choice, and type 'import sqlite3'
like so:
monte@hp-dv4-linux:~$ python
Python 2.7.2+ (default, Oct 4 2011, 20:06:09)
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.7.7'
>>> quit()
monte@hp-dv4-linux:~$ python3
Python 3.2.2 (default, Sep 5 2011, 21:17:14)
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.7.7'
>>> quit()
monte@hp-dv4-linux:~$
Simple enough to test on your own. You can follow along a simple
tutorial from here if you like:
http://zetcode.com/db/sqlitepythontutorial/
BTW, that site has a lot of good tutorials... including one on Python +
PostgreSQL...
http://zetcode.com/db/postgresqlpythontutorial/
HTH,
Monte