Skip to content

Instantly share code, notes, and snippets.

@shijiezhou1
Last active June 21, 2024 01:17
Show Gist options
  • Save shijiezhou1/7a1187c9cc105ac421c2b3bf1331d3c1 to your computer and use it in GitHub Desktop.
Save shijiezhou1/7a1187c9cc105ac421c2b3bf1331d3c1 to your computer and use it in GitHub Desktop.
FAB json model
model
from sqlalchemy.dialects.postgresql import JSON
class JSONModel(Model):
__bind_key__ = 'APP_DB'
__tablename__ = 'json_model'
id = Column(Integer, primary_key=True)
value = Column(JSON, nullable=True)
class JSONModelApi(ModelRestApi):
resource_name = "json_model"
datamodel = SQLAInterface(JSONModel)
allow_browser_login = True
appbuilder.add_api(JSONModelApi)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment