Name
execute( )
Signature
cursor
=execute
(sql [,parameters])
Synopsis
Sends arbitrary SQL to MySQL for execution. If the SQL specified is parameterized, the optional second argument is a sequence or mapping containing parameter values for the SQL. Any results or other information generated by the SQL can then be accessed through the cursor.
The parameters of this method may also be lists of tuples to enable
you to perform multiple operations at once. This usage is considered
deprecated as of the DB-API 2.0 specification. You should use the
executemany( )
method instead.
Example
connection = MySQLdb.connect(host='carthage', user='test', passwd='test', db='test'); cursor = connection.cursor( ); cursor.execute('SELECT * FROM TNAME');
Get Managing & Using MySQL, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.