class SQLAlchemy(BaseSQLAlchemy):

    def make_declarative_base(self):
        metadata = MetaData(naming_convention={'pk': 'pk_%(table_name)s',
            'fk':
            'fk_%(table_name)s_%(column_0_name)s_%(referred_table_name)s',
            'ix': 'ix_%(table_name)s_%(column_0_name)s', 'uq':
            'uq_%(table_name)s_%(column_0_name)s', 'ck':
            'ck_%(table_name)s_%(constraint_name)s'})
base = declarative_base(metadata=metadata, cls=Model, name='Model',
    metaclass=_BoundDeclarativeMeta)
base.query = _QueryProperty(self)
return base
Changing constraint naming conventions in Flask-SQLAlchemy