Python 从MySQL 的表中提取字段名

con = pymysql.connect(host='192.168.0.10', user='root', passwd='123456', db='living', port = 3306) # 连接

cur = con.cursor()
sql_order = 'select * from p_table'
p_table_in = read_table(cur, sql_order) 
sql_order = "select COLUMN_NAME from information_schema.COLUMNS where table_name = 'p_table' and table_schema = 'living' " 
p_table_name=read_table(cur, sql_order)
con.commit()
cur.close()
con.close()

你可能感兴趣的:(Python,MySQL)