Reputation: 612
I am inserting into a table using the following code:
## Connection established ##
sql = """ INSERT INTO Singer ( name ) VALUES( %s ) """
params = ('Rihanna',)
cursor.execute(sql, params)
cursor.fetchall() ## Result - into no result set
cursor.description ## Result - Nonetype
I am not able to understand where am I going wrong?
Thanks
Upvotes: 0
Views: 47
Reputation: 500
You have to commit your change.
cursor = conn.cursor()
sql = """ INSERT INTO Singer ( name ) VALUES( %s ) """
params = ('Rihanna',)
cursor.execute(sql, params)
conn.commit() # Important, apply changes to database!
cursor.fetchall() ## Result - into no result set
cursor.description ## Result - Nonetype
Upvotes: 2