Hi all,
I have some problem with sqlalchemy and mysql.
"""
class User(db.Model, UserMixin):
__tablename__ = 'user'
id = Column(Integer, autoincrement=True, nullable=False, unique=True, index=True)
coreid = Column(String(32), primary_key=True)
"""
u_r_association = Table('user_role', db.metadata,
Column('id', Integer, primary_key=True),
Column('user_id', Integer, ForeignKey('
user.id'), nullable=False),
Column('role_id', Integer, ForeignKey('
role.id'), nullable=False)
)
I create model and association table like this, my problems:
1. the autoincrement is invalid, i can't find it after create sql by sqlachemy.
2. how can i set the autoincrement with a initialize value.
3. how can i not generate the real foreignkey in databases, only leave it in model config.
thanks.