Creating database structures in a portable way
Bruno Desthuilliers
onurb at xiludom.gro
Mon Sep 18 12:00:08 EDT 2006
Samuel wrote:
> Hi,
>
> I am looking for a library that takes an XML file that specifies a
> table structure, and generates the CREATE/DROP/ALTER SQL statements to
> create the tables in the database.
>
> In particular, I am trying to port a PHP application that currently
> uses the AdoDB XML schema:
>
>> http://phplens.com/lens/adodb/docs-datadict.htm#xmlschema
>
> Is there a way to do something similar with the DB-API modules in
> Python?
FWIW, there's a Python port of adodb:
http://phplens.com/lens/adodb/adodb-py-docs.htm
and parsing XML in Python is quite easy. So you could as well port the
AdoDB XML to Python too.
OTOH, there are other - possibly better (YMMV) - DB abstraction layers
in Python, like SQLAlchemy. And since the above solution requires
(re)writing the xml-parsing part, it might be worth rewriting it so it
knows how to generate SQLAlchemy schemas instead.
My 2 cents...
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"
More information about the Python-list
mailing list