HTTP server + SQLite?

G

Gilles Ganault

Hello

I'd like to build a prototype that will combine a web server as
front-end (it must support GZIPping data to the remote client when
there are a lot of data to return), and SQLite as back-end, call the
server from a VB.Net application, and see how well this works. I want
to see if performance is significantly lower than using a server that
uses a binary protocol.

I'm no Python expert, so would appreciate any information on how to
combine a web server and SQLite into a single Python application. This
is just for a proof-of-concept, so it doesn't need to be
shipping-quality.

Thank you for any hint.
 
A

alex23

Gilles Ganault said:
I'm no Python expert, so would appreciate any information on how to
combine a web server and SQLite into a single Python application.

Hey Gilles,

I'm a fan of the http framework, CherryPy[1]. Very quick and easy to
get something up and running. The site also has some ideas on
interoperating with a database[2], although this might be a better
starting point[3]. SQLite is included in the Python standard library
past 2.5, but if you're stuck with either 2.3 or 2.4, the 3rd party
library pysqlite[4] provides support for them.

For a higher level web framework, I find Turbogears 2.x[5] really
straightforward. It's based around SQLAlchemy, which supports SQLite,
but sounds like it's probably overkill for your situation.

1: http://www.cherrypy.org/
2: http://tools.cherrypy.org/wiki/Databases
3: http://code.activestate.com/recipes/496799/
4: http://code.google.com/p/pysqlite
5: http://turbogears.org/2.0/
 
C

Chris Rebert

I'd like to build a prototype that will combine a web server as
front-end (it must support GZIPping data to the remote client when
there are a lot of data to return), and SQLite as back-end, call the
server from a VB.Net application, and see how well this works. I want
to see if performance is significantly lower than using a server that
uses a binary protocol.

I'm no Python expert, so would appreciate any information on how to
combine a web server and SQLite into a single Python application. This
is just for a proof-of-concept, so it doesn't need to be
shipping-quality.

If your want to write a basic/low-level HTTP server:
http://docs.python.org/library/basehttpserver.html
Looks like you'd use HTTPServer and a custom subclass of BaseHTTPRequestHandler.

If you want to write at the slightly higher WSGI
(http://www.python.org/dev/peps/pep-0333/) level of abstraction, you
can have your WSGI application run by a simple Python HTTP server such
as:
http://pythonpaste.org/modules/httpserver.html

As Alex said, SQLite is in the std lib:
http://docs.python.org/library/sqlite3

Cheers,
Chris
 
H

Helmut Jarausch

Hello

I'd like to build a prototype that will combine a web server as
front-end (it must support GZIPping data to the remote client when
there are a lot of data to return), and SQLite as back-end, call the
server from a VB.Net application, and see how well this works. I want
to see if performance is significantly lower than using a server that
uses a binary protocol.

I'm no Python expert, so would appreciate any information on how to
combine a web server and SQLite into a single Python application. This
is just for a proof-of-concept, so it doesn't need to be
shipping-quality.

You might have a look at
http://www.karrigell.fr/doc/

Helmut.

--
Helmut Jarausch

Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany
 
N

Nat

interesting

(e-mail address removed)
(e-mail address removed)
(e-mail address removed)
(e-mail address removed)
(e-mail address removed)
(e-mail address removed)
(e-mail address removed)
 
L

lbolla

Hello

I'd like to build a prototype that will combine a web server as
front-end (it must support GZIPping data to the remote client when
there are a lot of data to return), and SQLite as back-end, call the
server from a VB.Net application, and see how well this works. I want
to see if performance is significantly lower than using a server that
uses a binary protocol.

I'm no Python expert, so would appreciate any information on how to
combine a web server and SQLite into a single Python application. This
is just for a proof-of-concept, so it doesn't need to be
shipping-quality.

Thank you for any hint.

I quite like web.py: http://webpy.org/
L.
 
J

John Nagle

Gilles said:
Hello

I'd like to build a prototype that will combine a web server as
front-end (it must support GZIPping data to the remote client when
there are a lot of data to return), and SQLite as back-end, call the
server from a VB.Net application, and see how well this works. I want
to see if performance is significantly lower than using a server that
uses a binary protocol.

I'm no Python expert, so would appreciate any information on how to
combine a web server and SQLite into a single Python application. This
is just for a proof-of-concept, so it doesn't need to be
shipping-quality.

Thank you for any hint.

There's no reason you can't do that. Whether you want to is another issue.
There are, after all, plenty of web servers out there. Also, SQLite really
is a "lite" database. Although there's good read concurrency, multiple
updates from multiple processes tend to result in sizable delays, since
the locking is via file locks and wait/retry logic.

John Nagle
 
B

Bryan

John said:
[...] SQLite really
is a "lite" database.  Although there's good read concurrency, multiple
updates from multiple processes tend to result in sizable delays, since
the locking is via file locks and wait/retry logic.

True, and I have other gripes about SQLite, but I've fallen in love
with it. SQLite rocks. SQLite rocks like Python rocks. Hard as Python
had rocked before, Python started rockin' a whole bunch harder when
2.5 included SQLite3 in the standard library.

I love SQLite because it solves problems I actually have. For the vast
majority of code I write, "lite" is a good thing, and lite as it is,
SQLite can handle several transactions per second. I give SQLite a
file path and in a split second I have a relational, transactional
database. Great. I did not want to configure a server and I sure did
not want to inflict complexity upon my users.

If you are smart and/or lucky enough to write a web app so popular
that it outgrows SQLite, you can switch over to a big-time SQL server
DBMS. At worst, you'll have to tweak some of the code. Imagine how
much harder the scaling problem would be if the persistent data were
stored via pickle.

The SQLite developers state the situation brilliantly at
http://www.sqlite.org/whentouse.html:

"SQLite is not designed to replace Oracle. It is designed to replace
fopen()."
 
G

Gilles Ganault

I love SQLite because it solves problems I actually have. For the vast
majority of code I write, "lite" is a good thing, and lite as it is,
SQLite can handle several transactions per second. I give SQLite a
file path and in a split second I have a relational, transactional
database. Great. I did not want to configure a server and I sure did
not want to inflict complexity upon my users.

Exactly. I need a safe way to share an SQLite database among a few
years, but sharing a drive isn't safe but I also don't need a
full-fledged DBMS like MySQL.

At this point, as an alternative to a Python-based solution, it seems
like Mongoose + Lua + SQLite could do the trick.
 
T

Terry Reedy

The SQLite developers state the situation brilliantly at
http://www.sqlite.org/whentouse.html:

For future reference, that link does not work with Thunderbird. This one
does.

http://www.sqlite.org/whentouse.html

When posting links, best to put them on a line by themselves, with NO
punctuation, even if 'proper' English seems to require it. A space
before the colon probably would have worked too, if its complete absence
bothers one too much ;=).

Terry Jan Reedy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top