Flat file database

John Roth newsgroups at jhrothjr.com
Tue Dec 23 20:05:46 CET 2003


"Art Decco" <please.dont at email.com> wrote in message
news:UQRFb.115936$8y1.365571 at attbi_s52...
> Is there any Python module designed to simplify the use of a plain text
file
> as a flat file database?
>
> I realize that's a bit vague, but I'm just wondering about the best
approach
> for creating a little database-backed CGI app using Python on a server
with
> no real database available. The server belongs to the ISP, and I don't get
> to install "real" software, but they do have a cgi-bin directory for me,
and
> they do have a relatively recent Python, so I've got Python cgi apps
working
> via "#!/usr/local/bin/python". I can get the apps to write and read plain
> text files right in the cgi-bin directory, too, so I can use that as a
> simple, flat file database.

Python 2.3 has a CSV module to read and write files in Comma
Separated Variable format. This might do the job for you if you can
stand to read the file and convert it to in-storage objects, and then write
out a new version if it's updated.

Another possibility along the same lines is the pickle module: that can
put out an entire tree of objects, and then read them back in. That's
been around for a while. That will be availible for any release of
Python that your ISP is likely to have installed.

As far as relational support, I'd suggest hitting Google to see what
you can turn up.

John Roth






More information about the Python-list mailing list