-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is OPLOG supported? #194
Comments
I've never tried it. But I've skimmed through the code in Eve and it seems it is independent of the datalayer anyway. So you could try to manually configure an appropriate model and setting the |
@tallesl Did you happen to get this to work? If I simply enable OPLOG in the Eve settings, it doesn't seem to work (no error messages either). |
Got this to work. Posting it here, in case it helps anyone. Had to do the following:
My final configs look as follows: Sqlalchemy model: class CommonColumns(Base):
"""Common columns"""
__abstract__ = True
_created = Column(TIMESTAMP, default=func.now())
_updated = Column(TIMESTAMP, default=func.now(), onupdate=func.now())
class Oplog(CommonColumns):
"""Model that stores operational logs"""
__tablename__ = "oplog"
o = Column(String(10))
r = Column(String(100))
i = Column(String(36), primary_key=True)
c = Column(JSON)
ip = Column(String(50))
u = Column(String(50)) App settings: DOMAIN = DomainConfig({"oplog": ResourceConfig(Oplog)}).render()
IF_MATCH = False
HATEOAS = False
# Oplog
OPLOG = True
OPLOG_CHANGE_METHODS = ['PATCH', 'PUT', 'DELETE', 'POST']
OPLOG_AUDIT = True
OPLOG_NAME = "oplog" Oplog push hook: def oplog_extras(resource, entries):
schema = DOMAIN['oplog']['schema']
app.config["DOMAIN"]['oplog']["schema"] = schema
app.on_oplog_push += oplog_extras |
I'd be happy to provide compatibility for newer Eve versions, but my personal dev time is limited and I'm not able to use Eve-SQLAlchemy anymore at work. If anyone steps in and does the necessary work, I'd be happy to provide some guidance and review. |
https://docs.python-eve.org/en/stable/features.html#operations-log
The text was updated successfully, but these errors were encountered: