r.table('todos').get(todo_id).run(g.rdb_conn)
It would be more natural to have it go the other way: g.rdb_conn.run(r.table('todos').get(todo_id))
This way, the connection runs the request instead of the other way round.Also, you are opening and closing DB connections with each HTTP request. I imagine this is for the purpose of simplifying the example. However, it does make me curious: how expensive is the creation of a new connection? Are connections thread-safe? Would it make sense to have connection pooling?