I am new to SQL and SQLalchemy, but say I have a class like this:

class User(Base):
    __tablename__ = "users"

    id = Column(Integer, primary_key=True)
    name = Column(String, unique=True)
    join = Column(DateTime)
    infractions =Column(Integer)
    posts = Column(Integer)

    def __init__(self, name):
        self.name = name
        self.join = datetime.datetime.now()
        self.infractions = 0
        self.posts = 0


but I wanted to change it to this:
class User(Base):
    __tablename__ = "users"

    id = Column(Integer, primary_key=True)
    name = Column(String, unique=True)
    join = Column(DateTime)
    infractions =Column(Integer)
    #posts = Column(Integer) REMOVE POSTS
    bannedTill = Column(DateTime)   #ADD BANNEDTILL

    def __init__(self, name):
        self.name = name
        self.join = datetime.datetime.now()
        self.infractions = 0
        self.bannedTill = datetime.datetime.now()


Where I remove the column posts and add a column "bannedTill". What
are the steps to update my table "users" to reflect these changes
without losing the data that is already in the table (I will populate
my new field manually).

-- 
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