pyeve / eve-sqlalchemy

SQLAlchemy data layer for Eve-powered RESTful APIs
http://eve-sqlalchemy.readthedocs.io
Other
232 stars 70 forks source link

add support for and_ and or_ conjunctions in sqla expressions #49

Closed toxsick closed 9 years ago

toxsick commented 9 years ago

The sqla query syntax is much more advanced in comparison to the ast syntax. One thing missing is the ability to use conjunctions for more complex queries. Here is my shot on this. It will allow you to make queries like:

http://127.0.0.1:5000/people?where={"and_": [{"age": "__gt__(10)"}, {"age": "__lt__(20)"}]}
http://127.0.0.1:5000/people?where={"or_": [{"name": "john", "age": "__gt__(10)"}, {"age": "__lt__(20)"}]}

What do you guys think?

cheers Hannes

amleczko commented 9 years ago

It looks nice. thanks!