On Mar 13, 2008, at 10:09 PM, James Henstridge wrote: > On 13/03/2008, Martijn Faassen <[EMAIL PROTECTED]> wrote: >> Looking at Storm I noticed one thing that seems to be missing that >> other >> ORM tools for Python do seem to offer: a way to do table >> definitions in >> Python. Instead in the tutorial direct 'create table' statements are >> used. I'd be interesting to hear whether this missing feature is >> intentional, and if so, what the reasons behind this decision are. > > I wrote a short article about my feelings on this subject here: > > http://blogs.gnome.org/jamesh/2007/09/28/orm-schema-generation/ > > In short, I think a "generate a schema from Python classes" feature > will be useless for any long running project that evolves its schema > over time (unless throwing away all your previous data is an option > ...). > > I do think it would be useful to have some tool that helps people > manage a database schema as a series of patches though. I've been > told that Ruby on Rails does this quite well.
Rails works from a different perspective. It introspects on the database and auto creates various model properties from that. The migrations are used to handle moving data to a new schema within the context. There is no reason why a generate schema from class feature couldnt introspect the database, see what differences exist with current model definition and alter the table keeping the data intact. Its obviously more complicated ( and in some cases impossible ) but given that in many situations ( perhaps most ) it could be handled, I dont see why you wouldnt want it. If I'm adding new tables or doing anything that a simple alter table sql can do, then why wouldnt i want the orm to handle it automatically and I can deal with edge cases? If I have to define the schema in sql then really, I shouldnt have to list out everything again in my class. Defining the same information in two places ( create table, migrations ) and in the code just strikes me as wrong. Ideally, I want an orm that either acts like ActiveRecord and introspects as much info out of the database as possible leaving my models as spare as possible or one more like DataMapper which handles the schema creation ( although not migrations yet ) as much as possible. -- storm mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/storm
