Python database of plain text editable by notepad or vi

James Harris james.harris.1 at googlemail.com
Sat Mar 27 13:01:34 EDT 2010


On 26 Mar, 14:58, Jon Clements <jon... at googlemail.com> wrote:
> On 26 Mar, 09:49, James Harris <james.harri... at googlemail.com> wrote:
...
> > I'm toying with some
> > ideas for a way to help generate source code (in various languages,
> > not just Python). If it goes ahead the text files would be mainly
> > marked-up code snippets - with or without symbols that need to be
> > replaced.
>
> > Rather than write one single monolithic app I thought to split it into
> > reusable components. One part being data access could perhaps be an
> > existing database (and I'll take a look at jkn's suggestion).
>
> > Think of the database as similar to an associative array stored on
> > disk. The only difference is I may want to play fast and loose with
> > the keys in some ways - e.g. check for partial key matches or return a
> > list of part-matched keys. The language name could be part of the key
> > but I'd also need to store variants for specific language versions.
> > I'm not sure yet how it will all pan out. As I say, just throwing
> > around some ideas.
...
> Thanks for the explanation.

No problem. Thanks for taking an interest!

> Who admins and, who's editing this data?

For the app I have in mind a programmer would admin and edit the
files.

> I couldn't 100% guarantee that I could modify a text file and always
> put the right
> delimiter in the right place and remember to escape the relevant chars
> (and I'm
> probably not the 'average' user).

Apart from any markup each file would be just source code or, maybe,
individual fragments of source code so there would be few delimiters
to get right. And any that were wrong could be detected either by the
code writer or the compiler when used.

> Any opposition to just putting it in a 'proper' DB, then 'blobbing'
> the values?
> (or just integrate a procedure/script/function whatever your chosen
> RDBMS calls to choose it).
> Or in some systems, 'externally referencing'... loads of DB's have
> free front-ends,
> and there are lots of Python libraries.

I've thought of that. Like Ethan, though, I'd prefer simple text for
this. Databases, for good reasons, tend to obscure text. For one thing
it makes them more secure but it also makes them less transparent and
harder to examine and edit. For this app simple text files seem to be
the best option at the moment.

>
> I think perhaps, all I'm saying is, I'd choose a different approach.
> I'd provide a front-end, rather than choose to re-write the wheel over
> DB's.

Agreed. That was my reason for asking the question initially.

> Be nice to know how you get on, if you'd be so kind?

I don't know yet if it will be feasible but if I do eventually write
something I'll report back.

James



More information about the Python-list mailing list