I'm using Eve-SQLAlchemy to access data in SQLite database. I have a People
class:
class People(BaseModel):
'''Test class'''
__tablename__ = 'people'
id = Column(Integer, primary_key=True)
firstname = Column(String)
lastname = Column(String)
born = Column(Date)
REST API works nicely with this query:
curl -s http://127.0.0.1:5000/people/1
{
"id": 1,
"firstname": "Isaac",
"lastname": "Newton",
"born": "1642-12-25",
"_updated": "Fri, 19 Apr 2019 14:03:08 GMT",
"_created": "Fri, 19 Apr 2019 14:03:08 GMT",
"_etag": "69a44481049920b40b7c06e651ed6c561f8b4892",
"_links": {
"self": {
"title": "People",
"href": "people/1"
},
"parent": {
"title": "home",
"href": "/"
},
"collection": {
"title": "people",
"href": "people"
}
}
}
However, if I try to use WHERE
:
curl -s 'http://127.0.0.1:5000/people?where={"firstname":"Isaac"}'
I get this in server console:
127.0.0.1 - - [22/Nov/2019 17:23:05] "GET /people?where="firstname":"Isaac" HTTP/1.1" 500 -
Traceback (most recent call last):
File "/home/mark/projects/nlp_pipeline/venv/lib/python3.7/site-packages/eve/flaskapp.py", line 1106, in __call__
return super(Eve, self).__call__(environ, start_response)
File "/home/mark/projects/nlp_pipeline/venv/lib/python3.7/site-packages/flask/app.py", line 2463, in __call__
return self.wsgi_app(environ, start_response)
File "/home/mark/projects/nlp_pipeline/venv/lib/python3.7/site-packages/flask/app.py", line 2449, in wsgi_app
response = self.handle_exception(e)
File "/home/mark/projects/nlp_pipeline/venv/lib/python3.7/site-packages/flask/app.py", line 1866, in handle_exception
reraise(exc_type, exc_value, tb)
File "/home/mark/projects/nlp_pipeline/venv/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/home/mark/projects/nlp_pipeline/venv/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "/home/mark/projects/nlp_pipeline/venv/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/mark/projects/nlp_pipeline/venv/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/mark/projects/nlp_pipeline/venv/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/home/mark/projects/nlp_pipeline/venv/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "/home/mark/projects/nlp_pipeline/venv/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/mark/projects/nlp_pipeline/venv/lib/python3.7/site-packages/eve/endpoints.py", line 56, in collections_endpoint
response = get(resource, lookup)
File "/home/mark/projects/nlp_pipeline/venv/lib/python3.7/site-packages/eve/methods/common.py", line 318, in rate_limited
return f(*args, **kwargs)
File "/home/mark/projects/nlp_pipeline/venv/lib/python3.7/site-packages/eve/auth.py", line 80, in decorated
return f(*args, **kwargs)
File "/home/mark/projects/nlp_pipeline/venv/lib/python3.7/site-packages/eve/methods/common.py", line 1354, in decorated
r = f(resource, **combined_args)
File "/home/mark/projects/nlp_pipeline/venv/lib/python3.7/site-packages/eve/methods/get.py", line 51, in get
return get_internal(resource, **lookup)
File "/home/mark/projects/nlp_pipeline/venv/lib/python3.7/site-packages/eve/methods/get.py", line 125, in get_internal
return _perform_find(resource, lookup)
File "/home/mark/projects/nlp_pipeline/venv/lib/python3.7/site-packages/eve/methods/get.py", line 266, in _perform_find
resource, req, lookup, perform_count=not config.OPTIMIZE_PAGINATION_FOR_SPEED
TypeError: find() got an unexpected keyword argument 'perform_count'
What's the reason and how can I fix that?
Python 3.7, package versions:
Eve==0.9.2
Eve-SQLAlchemy==0.7.1
Flask-SQLAlchemy==2.4.1
SQLAlchemy==1.3.11
You're using Eve-SQLAlchemy with a not yet supported version of Eve. Eve-SQLAlchemy 0.7.1 supports Eve<0.8
, but you are using Eve==0.9.2
Running pip install .
in Eve-SQLAlchemy's root directory should install the correct dependencies, including Eve==0.7.10
.