You are invited to Log in or Register a free Frihost Account!

Python and SQLite

For a little project I wanted to host here I need Python and a SQL database à la MySQL. Both are available here on Frihost but somehow I didn't find a means to connect both.
Thus I have been thinking about several alternatives:

* Option 1 - find a different free hosting service where I can get Python to work together with MySQL.
* Option 2 - re-write my server in Perl
* Option 3 - use a different database, e.g. SQLite.

After I failed with option 1 and found option 3 too labour intensive I am trying option 2 now.

SQLite is a way to create a database in a single file and use SQL as an interface to that database. All you need is a space where you can write a file and a module supporting this: SQLite3 that is for Python.

As the authors of SQLite write:

SQLite is a C library that provides a lightweight disk-based database that doesn’t require a separate server process and allows accessing the database using a nonstandard variant of the SQL query language. Some applications can use SQLite for internal data storage. It’s also possible to prototype an application using SQLite and then port the code to a larger database such as PostgreSQL or Oracle.

Thus SQLite is useful for initial development and even might work for small and medium-size applications. Interesting to read in this Wikipedia article:

It is arguably the most widely deployed database engine, as it is used today by several widespread browsers, operating systems, and embedded systems, among others.

To make sure this actually works I decided to first come up with a little Python program to just test out SQLite capabilities. And finally I actually decided to enhance my Python Expression Evaluator to allow entering SQL statements as well, using SQLite as the backend. More about this in my next blog posting ...

0 blog comments below

© 2005-2011 Frihost, forums powered by phpBB.