Adding fetchone provides a convenient way to get a single row tuple. Adding fetchmany and fetchall methods make the methods consistent with the DB API 2.0 cursor specifications.
Description
There is currently no easy way to return a single row, equivalent to cursor.fetchone using the etl methods. Instead, values need to be unpacked from a list, or calling next on iter_rows results. Adding a fetchone function would make this nicer. It would just use iter_rows and return the first value.
fetchmany could be modelled on the the cursor.fetchmany call signature and use itertools.slice to return the correct number of rows. Whether or not to use named arguments and default values should be investigated.
fetchall would be synonymous with get_rows.
These new functions would be defined in the etl module.
Acceptance criteria
[ ] New fetchone function returns single tuple
[ ] New fetchmany function returns list of tuples of specified length
[ ] New fetchall function returns list of all tuples
[ ] Integration tests are provided for at least PostgreSQL implementation
Summary
Adding
fetchone
provides a convenient way to get a single row tuple. Addingfetchmany
andfetchall
methods make the methods consistent with the DB API 2.0 cursor specifications.Description
There is currently no easy way to return a single row, equivalent to
cursor.fetchone
using theetl
methods. Instead, values need to be unpacked from a list, or callingnext
oniter_rows
results. Adding afetchone
function would make this nicer. It would just useiter_rows
and return the first value.fetchmany
could be modelled on the thecursor.fetchmany
call signature and useitertools.slice
to return the correct number of rows. Whether or not to use named arguments and default values should be investigated.fetchall
would be synonymous withget_rows
.These new functions would be defined in the
etl
module.Acceptance criteria
fetchone
function returns single tuplefetchmany
function returns list of tuples of specified lengthfetchall
function returns list of all tuples