Comments (5)
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 OPLOG_*
settings accordingly. If this works, we can add an example to the docs or think about including that oplog model in our codebase.
from eve-sqlalchemy.
@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).
from eve-sqlalchemy.
Update: Looks like I'm hitting this bug, which seems to have been fixed in eve 0.8.
@dkellner The latest release of eve-sqlalchemy requires eve < 0.8, which was released in 2018. Any plans to support a newer version of eve?
from eve-sqlalchemy.
Got this to work. Posting it here, in case it helps anyone. Had to do the following:
- Had to fork Eve 0.7.10 (the latest version supported by eve-sqlalchemy) and and integrate this fix into my fork.
- Unfortunately, eve hardcodes the oplog schema, so even after defining the model using sqlalchemy, eve would simply overwrite the schema and consequently fail. I had to add a
on_oplog_push
hook to re-overwrite the schema.
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
from eve-sqlalchemy.
@dkellner The latest release of eve-sqlalchemy requires eve < 0.8, which was released in 2018. Any plans to support a newer version of eve?
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.
from eve-sqlalchemy.
Related Issues (20)
- Creating model instance does not respect "viewonly" relationship attribute HOT 1
- Column of type UUID fails to insert default HOT 1
- 502 for PATCH HOT 1
- Cannot replace BaseQuery with a Custom query_class (soft delete custom query class) HOT 1
- How to add validations with Eve-sqlalchemy HOT 1
- any plan to keep updated with eve ? HOT 1
- Updating datasource leads to KeyError HOT 2
- Missing documentation on how to install
- TypeError: find() got an unexpected keyword argument 'perform_count' HOT 1
- eve.exceptions.ConfigException: User.id is not unique HOT 1
- Please specify `related_resources` manually HOT 2
- TypeError: '_updated' is an invalid keyword argument for Network HOT 2
- Is it possible to change compatible version of Eve from "<0.8" to the latest Eve? HOT 1
- Many-to-many issue HOT 1
- UserWarning: No validation schema is defined for the arguments of rule 'data_relation' / 'dependencies' / 'unique' HOT 1
- when will be eve_sqlalchemy update? HOT 2
- Support for SQLAlchemy 1.4
- Upgrade to eve-sqlalchemy 0.7.1 / hybrid_property / AttributeError: Neither 'InstrumentedAttribute' object nor 'Comparator' object associated with <relation> has an attribute <column>
- ImportError: cannot import name 'Iterable' from 'collections'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eve-sqlalchemy.