patch for RowProxy objects to support slicing

Issue #686 resolved
Former user created an issue

Since a RowProxy object supports accessing its items by integer index, and generally emulates almost all tuple behavior, it ought to support slicing, too.

resultrow = mytable.select().execute().fetchone() resultrow0 works, but resultrow:0 fails with TypeError: unhashable type

I'm attaching a simple patch to /engine/base.py. With the patch, slicing a RowProxy object returns a tuple, exactly as if it were the tuple it appears to be. Arguably, the slice should itself be a RowProxy, but implementing that gets complicated.

Comments (6)

  1. Log in to comment