dbdemo.py, text of dbdemo.py, text of login.html, text of logout.html, text of query.html, text of result.html.
Standalone Python program demonstrating database queries:
test.py,
test.py output
NOTE: See PostgreSQL and SQL Resources Section below for how to avoid
SQL injection attacks.
Exercise: Modify the following todo app to add this functionality:
todo.py, text of todo.py, text of todo.html, schema for original todo table.
If necessary, use these SQL commands to drop the original todo table and todo id sequence from your database:
drop sequence todo_id_seq;
drop table todo;
Look below for resources.
todos = list(db.query('select * from todo order by id asc;'))
This is useful if you want to iterate through the list more than once;
an iterable object can be iterated through only once.