I know i can define a table using Table:
user = Table(\'user\', metadata,
Column(\'user_id\', Integer, primary_key = True),
)
and using Bas
Base = declarative_base()
class User(Base):
__tablename__ = 'user'
id = Column('id', Integer, primary_key=True)
name = Column('name', Unicode(64))
is just syntactic sugar for
metadata = MetaData()
user = Table('user', metadata,
Column('id', Integer, primary_key=True),
Column('name', Unicode(64)),
)
class User(object):
pass
mapper(User, user) # this will modify the User class!