supersetmodelscore.py
下进行添加模型
class ExeclInfoAdd(Model): __tablename__ = 'ExeclInfoAdd' type = "table" id = Column(Integer,primary_key=True) name = Column(String(256)) info = Column(String(256)) ExeclInfoAdd.__table__.create(db.engine, checkfirst=True)
supersetviewscore.py
下进行添加视图
class ExeclInfoAddView(SupersetModelView, DeleteMixin): # noqa datamodel = SQLAInterface(models.ExeclInfoAdd) label_columns = {'name':'Name', 'info':'Info'} list_columns = ['name', 'Name'] appbuilder.add_view( ExeclInfoAddView, "Execl Add Luke", label=__("Execl Add"), category="Sources", category_label=__("Sources"), icon='fa-cogs')
model的初始化(建表)用migrate工具来处理
执行superset db migrate
再执行superset db upgrade