Question: Newbie working with db2. Developing a python script using ibm\_db package. I have a select query where i am binding params using ibm\_db.bind\_param(stmt, 1,param1). and then doing a result = ibm\_db.execute(stmt). How can I get the results from the query. the documentation is scarce on this topic. Would appreciate any example code.

Answer: 
After `ibm_db.execute(stmt)` you need to fetch data from a result
try this:

```
data = ibm_db.fetch_assoc(stmt)

```

Fetch data from a result set by calling one of the fetch functions.

`ibm_db.fetch_tuple`: Returns a tuple, which is indexed by column position, representing a row in a result set. The columns are 0-indexed.

`ibm_db.fetch_assoc`: Returns a dictionary, which is indexed by column name, representing a row in a result set.

`ibm_db.fetch_both`: Returns a dictionary, which is indexed by both column name and position, representing a row in a result set.

`ibm_db.fetch_row`: Sets the result set pointer to the next row or requested row. Use this function to iterate through a result set.
Study the examples for fetching result-sets in Python with ibm\_db, that are in the Db2 knowledge center online at this [link](https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.swg.im.dbclient.python.doc/doc/t0054388.html)