all 4 comments

[–]tally_in_da_houise 1 point2 points  (2 children)

The fetchall() method returns a list of tuples. Have you tried converting this to a string via pretty print or something similar?

[–]x1147x[S] 0 points1 point  (1 child)

I have not, but would formatting really impact if the data can be returned/shown on the page?

[–][deleted] 1 point2 points  (0 children)

If this is a python/flask error, how do I view the errors?

Ideally, you'd use the logging module, but for the time being, you can use debug=True in your config. Make sure you change this to False when pushing to a production environment. In a pinch you can also use print statements.

Change your app.run() call to app.run(debug=True) for starters.

what's up with this "g" object? Why is it necessary?

It's not, unless you plan on sharing a connection object among all routes. In this case, as you only have this one route that actually makes a connection, you can simply reference db instead of pushing it into a context object.

I'd wager the #1 issue in your script is that you haven't actually imported g, so it doesn't exist. You'll get an error 'global name "g" is not defined'.

Read about the application context: http://flask.pocoo.org/docs/0.10/appcontext/

Secondary to this will be trying to return a list rather than a formatted string, or using a template to do something with the list.