Thanks for all the info.  I feel a lot better about using this orm now
=]

On Dec 24, 7:50 pm, Michael Bayer <mike...@zzzcomputing.com> wrote:
> On Dec 24, 2009, at 3:44 PM, Nick Retallack wrote:
>
> > 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?
>
> Simple procedures like that are documented on the migrate site.
>
> > 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?
>
> I just reflect the tables I need wihtin the migration script, using "mytable 
> = Table('mytable', metadata, autoload=True)" .   It doesn't matter what 
> system was used to generate the existing schema.
>
> > And how does this work?  Does sqlalchemy-migrate monkey-patch the
> > standard sqlalchemy column so that same object now has extra methods?
>
> that is what they do, yeah.
>
> > 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 think they are a little hysterical in their documentation regarding this.  
> Just reflect the tables you need, there's no need to repeat the existing 
> structure of tables in the migration scripts or worry about whatever the 
> related code says or does not say.
>
> > I get sqlalchemy-migrate to just find a table in my database by name,
> > instead?
>
> that's reflection (see above).    At some point someone needs to convince 
> them its OK to use reflection and to have them change their docs.
>
>
>
> > It would be much simpler if I could just print out the new schema and
> > change things manually.  
>
> this is described in the FAQ entry I sent in my previous email.
>
> > 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.
>
> I've no idea what that practice is.
>
>
>
>
>
> > On Dec 22, 2:06 pm, Michael Bayer <mike...@zzzcomputing.com> 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 sqlalch...@googlegroups.com.
> >>> To unsubscribe from this group, send email to 
> >>> sqlalchemy+unsubscr...@googlegroups.com.
> >>> 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 sqlalch...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > sqlalchemy+unsubscr...@googlegroups.com.
> > 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 sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.


Reply via email to