![]() |
HTTP server + SQLite?
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. |
Re: HTTP server + SQLite?
Gilles Ganault <nos...@nospam.com> wrote:
> 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/ |
Re: HTTP server + SQLite?
On Mon, May 3, 2010 at 12:46 AM, Gilles Ganault <nospam@nospam.com> wrote:
> 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 -- http://blog.rebertia.com |
Re: HTTP server + SQLite?
On 05/03/10 09:46, Gilles Ganault wrote:
> 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 |
Re: HTTP server + SQLite?
|
Re: HTTP server + SQLite?
On Mon, 03 May 2010 11:51:41 +0200, Helmut Jarausch
<jarausch@igpm.rwth-aachen.de> wrote: >http://www.karrigell.fr/doc/ Thanks for the tip. |
Re: HTTP server + SQLite?
On May 3, 8:46*am, Gilles Ganault <nos...@nospam.com> wrote:
> 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. |
Re: HTTP server + SQLite?
Gilles Ganault wrote:
> 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 |
Re: HTTP server + SQLite?
John Nagle wrote:
> [...] 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()." -- --Bryan |
Re: HTTP server + SQLite?
On Mon, 3 May 2010 23:07:08 -0700 (PDT), Bryan
<bryanjugglercryptographer@yahoo.com> wrote: >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. |
| All times are GMT. The time now is 08:44 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.