I've looked at sqlalchemy-migrate, but I can't figure out how it works. Can you give me an example of how to rename a column in an existing table?
http://packages.python.org/sqlalchemy-migrate/changeset.html#column They mention it here, but it's unclear where this column object came from. What if I created my tables using the declarative syntax, or elixir? Am I supposed to import the column I'm about to alter from my application somehow, and then call rename on the sqlalchemy object? And how does this work? Does sqlalchemy-migrate monkey-patch the standard sqlalchemy column so that same object now has extra methods? And what about how it advises me not to import things from my application? Perhaps the code for this table no longer exists when I'm running the migration, so I can't import that column anymore? Can I get sqlalchemy-migrate to just find a table in my database by name, instead? It would be much simpler if I could just print out the new schema and change things manually. In the IRC, people mentioned they just generate a new database in order to see what the new schema is, and then destroy it. This seems pretty silly to me. On Dec 22, 2:06 pm, Michael Bayer <[email protected]> wrote: > On Dec 21, 2009, at 9:05 PM, Nick Retallack wrote: > > > Say you've created some models in SQLAlchemy, and run create_all() to > > get them into the database. Later on, you changed some of their > > definitions, and you need to update the database schema to correspond > > to it. How would you do this? Can you get SQLAlchemy to output the > > current SQL representation of your models? > > since nobody has gotten to this today, this is in the FAQ > athttp://www.sqlalchemy.org/trac/wiki/FAQ#HowcanIgettheCREATETABLEDROPT.... > You also should look at sqlalchemy-migrate > athttp://code.google.com/p/sqlalchemy-migrate/. > > > > > > > -- > > > You received this message because you are subscribed to the Google Groups > > "sqlalchemy" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group > > athttp://groups.google.com/group/sqlalchemy?hl=en. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
