Created
May 29, 2020 18:18
-
-
Save dangayle/0f2d10111668b4757a11784ba56ddd94 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from app import db | |
from sqlalchemy import func, types | |
from sqlalchemy.dialects import postgresql | |
class JSONCache(db.Model): | |
id = db.Column(db.Integer, primary_key=True) | |
key = db.Column(db.String, nullable=False, index=True) | |
data = db.Column(postgresql.JSONB, nullable=False) | |
timestamp = db.Column(types.TIMESTAMP, server_default=func.now(), nullable=False) | |
__mapper_args__ = {"order_by": timestamp.desc()} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment