We've been using flask-restless for quite a while, and our API makes use of auto-increment numeric primary key as well as unique string, e.g:
class User(db.Model):
__tablename__ = 'users'
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.Unicode(255), nullable=False, unique=True)
# few more fields...
This worked fine with older version.
However, it last version I am getting this error:
pk_names = primary_key_names(model)
if primary_key:
if primary_key not in pk_names:
> raise ValueError(f'Column `{primary_key}` is not a primary key')
E ValueError: Column `name` is not a primary key
Is it possible to allow not just primary keys, but also unique keys as older version did?
We've been using flask-restless for quite a while, and our API makes use of auto-increment numeric primary key as well as unique string, e.g:
This worked fine with older version. However, it last version I am getting this error:
Is it possible to allow not just primary keys, but also unique keys as older version did?