Guys, I'm stumped here. Trying to retrieve a row from mysql using MySQLdb, I receive the number of matching rows found, not the data itself.

here's the code:

def getKbd(kb_num):
    query="SELECT kbd_name, kbd_data, kbd_ps FROM kbd_ WHERE kbd_number = %d " % kb_num
    a = c.execute(query)
    return a

print getKb(3)

the output is 1 (since one row matches. if I do sELECT * I get the number of rows in db.

here's the same query in mysql:

mysql> SELECT kbd_name, kbd_data, kbd_ps FROM kbd_ WHERE kbd_number = 3 ;
+-------------------------------------+------------------------------------------------------------------+-----------+
| kbd_name | kbd_data | kbd_passes |
+-------------------------------------+------------------------------------------------------------------+-----------+
| kbd name number 3 | kbd data for number 3 in here | 0 |
+-------------------------------------+------------------------------------------------------------------+-----------+
1 row in set (0.00 sec)


What I want to receive as output is a list or tuple with something like

Thanks, I've just come up with the same. Strange how the cursor does everything standart sql syntax does, but doesn't return queries

This question has already been answered. Start a new discussion instead.