Creating database structures in a portable way
Samuel
knipknap at gmail.com
Tue Sep 19 04:52:31 EDT 2006
> > SQLAlchemy looks pretty good, but unfortunately apparently requires
> > shell access for installation (or at least, I have not found any other
> > solution covered in the docs), which I can not use.
>
> It doesn't use binaries AFAIK, so just copying should work as well.
Indeed, from browsing the package it seems like a pure Python solution.
I installed it (but didn't test it yet because I have no code to drive
it yet).
> > Rewriting the schema is possible (I only want to keep it separated from
> > the code),
>
> Why ? Isn't your code supposed to use it ?
It often makes sense to use meta languages to enforce clean separation
of logic. In my experience it is helpful to separate the database logic
from the application logic.
> A first point is that the DB-API doesn't hide the differences between
> various SQL dialects.
I see.
> A second point is that DB-API requires you to
> embed SQL statements as strings, while SQLAlchemy allow you to build
> your SQL queries in pure Python.
I'd rather not rewrite every single Sql statement into Python, since it
would
1. replace code that has already proven to work by something untested.
2. add yet another abstraction, at the cost of performance.
Luckily, SQLAlchemy also lets me use SQL statements directly.
> (and FWIW, if using an existing DB, you
> don't even have to describe the schema a second time to use it). Well,
> just start playing with it, and I really doubt you'll want to come back
> to the embedded hand-written SQL !-)
If I ever write something from scratch I'll use it.
Thanks for your comments, this was very helpful.
-Samuel
More information about the Python-list
mailing list