I took a break yesterday afternoon to work on PyMigrate and SqlAlchemy integration. It’s kinda been hit an miss, and standing at a wall now.
I started with the easiest first, drop a table was fairly easy, just get a sqlalchemy.Table instance of the table and issue a drop command. Table drop done!
Next up was rename a table. Ok so the sqlalchemy.Table class does not support rename. Research kept coming up with sqlalchemy-migrate which supposedly has a rename. Took a moment and looked at sqlalchemy-migrate, but seemed like it was using pure sqlalchemy rename for a Table type. I got it running my creating a new table in the same structure and then inserting all the data from the old table before dropping. Sucks and this may change.
So next came the change column name for a table. Here again found that sqlalchemy didn’t have a rename. I could change the name but not save the changes. Finally broke down and installed sqlachemy-migrate.
Using the documentation I tried the rename/alter methods and found that they did not work either. No rename method on table, no alter on columns.
So I guess I’ll still use SqlAlchemy for the db connection, but I’ll have to continue to provide it with raw sql statements for the changes.
