这个方法似乎是可选的,那么写与不写的区别在哪里?
如果写了,是不是每个字段都要写?
class User(Base):
__tablename__ = 'users'
id = Column(Integer, primary_key=True)
name = Column(String)
password = Column(String)
def __init__(self, name, password):
self.name = name
self.password = password
def __repr__(self):
return "<User('%s','%s', '%s')>" % (self.name, self.password)