Note that there are some explanatory texts on larger screens.

plurals
  1. PORetrieve SQLite Entry in Flask
    text
    copied!<p>I'm using SQLite with Flask for the first time and trying to retrieve the data I just inserted into my database. My POST request which inserts JSON data into a database works fine (or at least does not return errors).</p> <p>I'm trying to display whatever I inserted to verify and doing it as follows:</p> <pre><code>cur = db.execute('select * from places order by id') entries = [dict(lat=row[0], long=row[1], address=row[2], name=row[3]) for row in cur.fetchall()] return entries </code></pre> <p>I'm getting an error 500 back. Why is this happening? I was only able to find two examples of doing and they are both doing what I have above.</p> <p><strong>EDIT:</strong></p> <p>Here's Flasks's error:</p> <pre><code>Traceback (most recent call last): File "/Users/nayef/.virtualenvs/uber-api/lib/python2.7/site-packages/flask/app.py", line 1701, in __call__ return self.wsgi_app(environ, start_response) File "/Users/nayef/.virtualenvs/uber-api/lib/python2.7/site-packages/flask/app.py", line 1689, in wsgi_app response = self.make_response(self.handle_exception(e)) File "/Users/nayef/.virtualenvs/uber-api/lib/python2.7/site-packages/flask/app.py", line 1687, in wsgi_app response = self.full_dispatch_request() File "/Users/nayef/.virtualenvs/uber-api/lib/python2.7/site-packages/flask/app.py", line 1361, in full_dispatch_request response = self.make_response(rv) File "/Users/nayef/.virtualenvs/uber-api/lib/python2.7/site-packages/flask/app.py", line 1450, in make_response rv = self.response_class.force_type(rv, request.environ) File "/Users/nayef/.virtualenvs/uber-api/lib/python2.7/site-packages/werkzeug/wrappers.py", line 711, in force_type response = BaseResponse(*_run_wsgi_app(response, environ)) File "/Users/nayef/.virtualenvs/uber-api/lib/python2.7/site-packages/werkzeug/wrappers.py", line 55, in _run_wsgi_app return _run_wsgi_app(*args) File "/Users/nayef/.virtualenvs/uber-api/lib/python2.7/site-packages/werkzeug/test.py", line 818, in run_wsgi_app app_iter = app(environ, start_response) TypeError: 'list' object is not callable </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload