- Python Web Scraping Cookbook
- Michael Heydt
- 145字
- 2021-06-30 18:44:07
How it works
Accessing a MySQL database using the mysql.connector involves the use of two classes from the library: connect and cursor. The connect class opens and manages a connection with the database server. From that connection object, we can create a cursor object. This cursor is used for reading and writing data using SQL statements.
In the first example, we used the cursor to insert nine records into the database. Those records are not written to the database until the commit() method of the connection is called. This executes the writes of all the rows to the database.
Reading data uses a similar model except that we execute an SQL query (SELECT) using the cursor and iterate across the rows that were retrieved. Since we are reading and not writing, there is no need to call commit() on the connection.
- 廣電5G從入門到精通
- 物聯(lián)網(wǎng)(IoT)基礎(chǔ):網(wǎng)絡(luò)技術(shù)+協(xié)議+用例
- 物聯(lián)網(wǎng)安全:理論、實(shí)踐與創(chuàng)新
- TCP/IP入門經(jīng)典(第5版)
- Oracle SOA Suite 11g Performance Tuning Cookbook
- 正在爆發(fā)的互聯(lián)網(wǎng)革命
- Socket.IO Real-time Web Application Development
- Mastering JavaFX 10
- 基于性能的保障理論與方法
- 物聯(lián)網(wǎng)工程導(dǎo)論(第3版)
- 物聯(lián)網(wǎng)工程概論
- 深入理解Nginx:模塊開發(fā)與架構(gòu)解析
- 異構(gòu)蜂窩網(wǎng)絡(luò)關(guān)鍵理論與技術(shù)
- OSPF協(xié)議原理與功能拓展
- 局域網(wǎng)組建與維護(hù)項目教程