sqlalchemy enum AttributeError: 'list' object has no attribute 'replace'
来源:互联网 发布:淘宝旗舰店的手机 编辑:程序博客网 时间:2024/06/05 03:27
在column中使用Enum:
class User(Base): __tablename__ = 'user' USER_ROLE_CHOICES = ['SU', 'GA', 'CU'] id = Column(Integer, primary_key=True) password = Column(String(128)) last_login = Column(DateTime) is_superuser = Column(Boolean) username = Column(String(30), unique=True) first_name = Column(String(30)) last_name = Column(String(30)) email = Column(String(30)) is_staff = Column(Boolean) is_active = Column(Boolean) date_joined = Column(DateTime) role = Column(Enum(USER_ROLE_CHOICES)) #AttributeError: 'list' object has no attribute 'replace' group = relationship('UserGroup', secondary=user_usergroup, backref='user')
在stackoverflower上找了一下,发现这么用可以:
role = Column(Enum('SU', 'GA', 'CU'))
0 0
- sqlalchemy enum AttributeError: 'list' object has no attribute 'replace'
- AttributeError: 'list' object has no attribute 'write_pdf'
- AttributeError: 'list' object has no attribute 'write_pdf'
- scrapy出现:AttributeError: 'list' object has no attribute 'xpath'
- AttributeError: 'classmethod' object has no attribute '__module__'
- AttributeError: 'module' object has no attribute 'getpass'
- AttributeError: ‘NoneType’ object has no attribute ‘clone’
- AttributeError: 'module' object has no attribute 'Serial'
- AttributeError: 'NoneType' object has no attribute 'clone'
- AttributeError: 'tuple' object has no attribute 'Multi'
- AttributeError: 'Response' object has no attribute 'json'
- AttributeError: 'module' object has no attribute(转)
- AttributeError: 'Connection' object has no attribute 'connection_errors'
- AttributeError: 'module' object has no attribute 'randint'
- AttributeError: 'module' object has no attribute 'HAVE_DECL_MPZ_POWM_SEC'
- AttributeError: 'WebDriver' object has no attribute
- AttributeError: 'NoneType' object has no attribute
- AttributeError: 'DisabledBackend' object has no attribute '_get_task_meta_for'
- hdu1729(博弈)
- c++ 名字查找
- C# LINQ去重复杂类型对象集合
- 关于Blocking IO, Non-Blocking IO 和 Asynchronous I/O的理解
- chrome调试工具常用功能整理
- sqlalchemy enum AttributeError: 'list' object has no attribute 'replace'
- 如何解决子div设置margin-top时影响父div的margin-top
- 怎么用java实现md5算法(转自csdn…
- css 网页背景 不滚动 效果
- iOS-界面跟随键盘移动
- 数据库建模 相关,不要一味的追求…
- hibernate处理数据的时候:Session …
- android 调试
- java数据类型转换, 基础不扎实 不…