On 20/02/07, kbochert <[EMAIL PROTECTED]> wrote:
>
> If I have a database (class)
>
> 4       class Person(SQLObject):
> 5
> 6           firstName = StringCol(length=100)
> 7           middleInitial = StringCol(length=1, default=None)
> 8           lastName = StringCol(length=100)
> 9           lastContact = DateTimeCol(default=datetime.now)
>
> with a few thousand entries, and I wish to add a new field to the
> table
>             age = Integer()  #(or whatever)
>
> how do I proceed?

If you've got a few thousand entries you'd like to keep, and are
likely to ever make changes again, I'd highly recommend that you get
the hang of writing sql statements and running them in the command
line client for your db.

It's very easy for altering tables.  A helpful shortcut is to change
your model to how you want it then run 'tg-admin sql sql' which will
show you the sql needed to create the tables in your chosen database.
It's then fairly easy to remove the columns that already exist, and
change the statement to an ALTER TABLE instead of CREATE TABLE.

It's a pain at first but you reap long term rewards in terms of
knowledge and understanding.

Ed

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to