rethinkdb-python
rethinkdb-python copied to clipboard
add `with` support to Python cursor
The Connection class in the Python driver currently supports the Python with structure, but our Cursor class does not. I just ran into a case where it would be nice to have this. An example for clarity:
with r.db('foo').table('bar').run(conn) as full_table:
for row in full_table:
pass # do something in reality
While our Cursors are not that expensive, it does make sure that things get cleaned up on-time.