python - How to fix ValueError: need more than 1 value to unpack? -
i following error when using below query,am giving variables when doing cursor.fetchall ,not sure why getting error,how overcome this?
query:-
query = """select metabuild,testbed gerrits.pw warehouse ='%s'"""%(warehouse_name) rows = cursor.execute(query) (metabuild,testbed)= cursor.fetchall()
error:-
(metabuild,testbed)= cursor.fetchall() valueerror: need more 1 value unpack
fetchall
returns list of tuples, 1 tuple per row. if query returns 1 row, do
(metabuild,testbed)= cursor.fetchall()[0]
Comments
Post a Comment