Open Manojkumarbyibm opened 3 months ago
Hello @Manojkumarbyibm Thank you for pointing it out. We will work on it and give support to the suggested APIs.
Hi @Manojkumarbyibm
There is ibm-dbi that implements dbapi 2.0. The implementation is file ibm_db_dbi.py.
Hi @readytheory
Having a similar feature in ibm_db , helps a lot and provides greater flexibility to end user.
Problem Statement:
While fetching data from executed query result . Currently ibm_db supports fetch_row, fetch_tuple, fetch_both, fetch_assoc.All these functions fetches one row at a time. It needs to be looped (while, for) to fetch more than one row, till end of result.Looping will decrease then performance of fetch and developer needs to code additional steps (i.e, looping) for achieving multiple row fetch .
fetch_row:
fetch_tuple:
fetch_both:
fetch_assoc:
Enhancement Request:
Python DB API (ibm_db_dbi) supports fetchall and fetchmany to retrieve rows from a database table. It provides greater flexiblity to end user on how many rows needs to be fetched at a time without need of looping. Since looping is eliminated, it will significantly increases fetch performance and developer can skip additional coding steps (i.e, looping) for achieving multiple row fetch .
1) fetchall():
fetches all the rows of a query result. It returns all the rows as a list of tuples. An empty list is returned if there is no record to fetch.
2) fetchmany(size):
returns the number of rows specified by size argument. When called repeatedly, this method fetches the next set of rows of a query result and returns a list of tuples.If no more rows are available, it returns an empty list.
Kindly please consider enhancing ibm_db to support fetchall and fetchmany functions, as it provides greater flexibility to end user.