一:两个对象 connection 与 cursor
调用connect()方法创建 connection对象:
connection = pymysql.connect(args)
connection对象方法与属性介绍:
close() Send the quit message and close the socket.
commit() Commit changes to stable storage.
cursor(cursor=None) Create a new cursor to execute queries with.
open Return True if the connection is open
begin() Begin transaction;
ping(reconnect=True) Check if the server is alive.
rollback() Roll back the current transaction.
select_db(db) Set current db.
show_warnings() Send the “SHOW WARNINGS” SQL command
cursor对象是用来与数据库进行交互的;通过connection对象调用cursor()方法创建cursor对象
cursor = connection.cursor()
#