Getting Flask-Migrate to Ignore SQL Views that are mapped as Flask-SQLAlchemy Models

前端 未结 1 1665
感情败类
感情败类 2021-01-19 12:41

I am using Flask-SQLAlchemy to define my models, and then using Flask-Migrate to auto-generate migration scripts for deployment onto a PostgreSQL database. I have defined a

相关标签:
1条回答
  • 2021-01-19 12:47

    I think (though haven't tested) that you can mark your Table as a view with the __table_args__ attribute:

    class ViewSampleView(db.Model):
        __tablename__ = 'vw_report_high_level_count'
        __table_args__ = {'info': dict(is_view=True)}
    
    id = db.Column(db.String(), primary_key=True)
    rowcount = db.Column(db.Integer(), nullable=False)
    
    0 讨论(0)
提交回复
热议问题