@
timonwong articles_table = Table('articles',metadata,
Column('id',Integer,primary_key=True),
Column('title',String(40)),
Column('author',String(40)),
Column('content',String(40)),
Column('ctime',Integer,default=0),
Column('status',Integer,default=0),
)
class Article(object):
>>def __repr__(self):
>>>>return "<Article('%s','%s','%s')>" % (self.title,self.author,self.content)
mapper(Article,articles_table)
data={"title":"xxxx","author":"oooo","content":"ksjfosjfos"}
u=Article(**data)
session.add(u)
运行提示:
u=Article(**data)
TypeError: __init__() got an unexpected keyword argument 'content'
很奇怪不报 title,author出错