About the Author |
|
xiii | |
About the Technical Reviewer |
|
xv | |
Acknowledgments |
|
xvii | |
Introduction |
|
xix | |
Part I: Getting Ready |
|
1 | (44) |
|
Chapter 1 Introduction and Installation |
|
|
3 | (42) |
|
|
3 | (5) |
|
|
4 | (1) |
|
Community and Enterprise Editions |
|
|
5 | (1) |
|
|
6 | (2) |
|
|
8 | (7) |
|
|
15 | (14) |
|
|
16 | (4) |
|
Microsoft Windows - MySQL Installer |
|
|
20 | (5) |
|
Linux - MySQL Yum Repository |
|
|
25 | (2) |
|
Verifying the Installation |
|
|
27 | (2) |
|
|
29 | (6) |
|
|
29 | (4) |
|
|
33 | (2) |
|
Creating the Application User |
|
|
35 | (2) |
|
Installing the world Sample Database |
|
|
37 | (4) |
|
|
41 | (2) |
|
|
43 | (2) |
Part II: The Legacy APIs |
|
45 | (212) |
|
Chapter 2 Connecting to MySQL |
|
|
47 | (36) |
|
Creating the Connection from Python |
|
|
47 | (11) |
|
|
48 | (2) |
|
Common Connection Options |
|
|
50 | (2) |
|
|
52 | (3) |
|
Reconfiguration and Reconnect |
|
|
55 | (2) |
|
Connection Best Practices |
|
|
57 | (1) |
|
|
58 | (6) |
|
Alternatives to Hardcoding the Configuration |
|
|
58 | (2) |
|
Using MySQL Configuration Files |
|
|
60 | (4) |
|
|
64 | (18) |
|
|
64 | (7) |
|
|
71 | (9) |
|
|
80 | (1) |
|
|
81 | (1) |
|
|
82 | (1) |
|
Chapter 3 Basic Query Execution |
|
|
83 | (50) |
|
|
83 | (22) |
|
Executing the Query: cmd_query() |
|
|
85 | (4) |
|
Retrieving Rows - get_rows() |
|
|
89 | (6) |
|
Automatic Conversion into Native Python Types |
|
|
95 | (3) |
|
Retrieving Rows - get_rows() With Limit |
|
|
98 | (3) |
|
Retrieving Rows - get_row() |
|
|
101 | (3) |
|
|
104 | (1) |
|
|
105 | (16) |
|
|
106 | (3) |
|
MySQLCursor - Execution Flow |
|
|
109 | (2) |
|
MySQLCursor - Query Execution |
|
|
111 | (4) |
|
|
115 | (3) |
|
The Dictionary and Named Tuple Cursor Subclasses |
|
|
118 | (3) |
|
|
121 | (10) |
|
|
122 | (1) |
|
|
122 | (5) |
|
|
127 | (4) |
|
|
131 | (2) |
|
Chapter 4 Advanced Query Execution |
|
|
133 | (90) |
|
|
134 | (17) |
|
Multiple Queries with Support for Results |
|
|
135 | (8) |
|
Multiple Queries Based on a Template |
|
|
143 | (5) |
|
|
148 | (3) |
|
|
151 | (5) |
|
|
156 | (6) |
|
Loading Data Using a CSV File |
|
|
162 | (8) |
|
Loading a Server-Side File |
|
|
163 | (1) |
|
Loading an Application-Side File |
|
|
164 | (1) |
|
|
165 | (5) |
|
|
170 | (5) |
|
|
175 | (13) |
|
|
188 | (2) |
|
|
190 | (6) |
|
Other Connection Utility Methods |
|
|
196 | (10) |
|
|
198 | (6) |
|
Server Information Methods |
|
|
204 | (2) |
|
|
206 | (8) |
|
|
207 | (2) |
|
|
209 | (5) |
|
|
214 | (7) |
|
The mysql.connector.connect() Function |
|
|
215 | (3) |
|
The _mysql_connector Module |
|
|
218 | (3) |
|
|
221 | (2) |
|
Chapter 5 Connection Pooling and Failover |
|
|
223 | (34) |
|
Connection Pooling - Background |
|
|
223 | (6) |
|
The pooling.MySQLConnectionPool Class |
|
|
224 | (2) |
|
The pooling.PooledMySQLConnection Class |
|
|
226 | (1) |
|
|
227 | (2) |
|
|
229 | (15) |
|
Creating a Connection Pool |
|
|
229 | (2) |
|
Using Connection Pool Connections |
|
|
231 | (8) |
|
|
239 | (2) |
|
Reconfiguring the Connections |
|
|
241 | (3) |
|
|
244 | (12) |
|
|
245 | (3) |
|
|
248 | (2) |
|
|
250 | (6) |
|
|
256 | (1) |
Part III: The X DevAPI |
|
257 | (146) |
|
|
259 | (46) |
|
|
261 | (2) |
|
|
263 | (4) |
|
|
267 | (8) |
|
Passing Individual Options |
|
|
268 | (4) |
|
|
272 | (2) |
|
|
274 | (1) |
|
|
275 | (2) |
|
|
275 | (1) |
|
|
276 | (1) |
|
|
277 | (17) |
|
|
278 | (6) |
|
Other Schema Methods and Properties |
|
|
284 | (2) |
|
|
286 | (3) |
|
|
289 | (1) |
|
|
289 | (2) |
|
|
291 | (1) |
|
|
292 | (1) |
|
|
293 | (1) |
|
|
294 | (4) |
|
|
298 | (6) |
|
|
299 | (1) |
|
result.DocResult and result.RowResult |
|
|
300 | (2) |
|
|
302 | (2) |
|
|
304 | (1) |
|
Chapter 7 The MySQL Document Store |
|
|
305 | (66) |
|
|
305 | (2) |
|
|
307 | (2) |
|
|
309 | (22) |
|
|
310 | (20) |
|
Other Collection Methods and Properties |
|
|
330 | (1) |
|
|
331 | (2) |
|
|
333 | (6) |
|
|
339 | (7) |
|
|
346 | (20) |
|
|
347 | (3) |
|
|
350 | (16) |
|
|
366 | (4) |
|
|
370 | (1) |
|
|
371 | (32) |
|
|
371 | (2) |
|
|
373 | (20) |
|
|
374 | (3) |
|
|
377 | (1) |
|
|
378 | (4) |
|
|
382 | (5) |
|
|
387 | (3) |
|
|
390 | (3) |
|
|
393 | (7) |
|
|
394 | (3) |
|
Queries with Multiple Result Sets |
|
|
397 | (3) |
|
|
400 | (3) |
Part IV: Error Handling and Troubleshooting |
|
403 | (102) |
|
|
405 | (48) |
|
Warnings, Errors, and Strict Modes in MySQL Server |
|
|
406 | (5) |
|
Treating Note Level Messages as Warnings |
|
|
406 | (2) |
|
|
408 | (2) |
|
|
410 | (1) |
|
Warning and Error Handling |
|
|
411 | (15) |
|
|
411 | (4) |
|
Fetching Warnings After cmd_query() |
|
|
415 | (6) |
|
Fetching Warnings with Cursors |
|
|
421 | (3) |
|
Fetching Warnings with the X DevAPI |
|
|
424 | (2) |
|
MySQL Error Numbers and SQL States |
|
|
426 | (6) |
|
|
427 | (2) |
|
|
429 | (3) |
|
|
432 | (9) |
|
|
433 | (4) |
|
Mapping Errors to Exception Classes |
|
|
437 | (1) |
|
|
438 | (3) |
|
|
441 | (3) |
|
What to Do When Things Go Wrong |
|
|
444 | (6) |
|
|
445 | (1) |
|
|
445 | (1) |
|
|
446 | (1) |
|
|
446 | (4) |
|
|
450 | (1) |
|
|
450 | (3) |
|
Chapter 10 Troubleshooting |
|
|
453 | (52) |
|
|
453 | (17) |
|
|
454 | (1) |
|
Determining the SQL Statement |
|
|
455 | (7) |
|
|
462 | (1) |
|
Reading the MySQL Connector/Python Source Code |
|
|
463 | (1) |
|
Changing the Implementation |
|
|
464 | (1) |
|
|
464 | (6) |
|
|
470 | (17) |
|
|
470 | (8) |
|
|
478 | (9) |
|
|
487 | (16) |
|
|
487 | (3) |
|
Data Too Long or Out of Range Value |
|
|
490 | (3) |
|
|
493 | (2) |
|
The Used Command Is Not Allowed with This MySQL Version |
|
|
495 | (1) |
|
Bulk Changes Causes Corruption or Errors |
|
|
496 | (1) |
|
Unsupported Argument When Creating the Connection |
|
|
497 | (1) |
|
Aborted Connections in the MySQL Server Error Log |
|
|
498 | (1) |
|
|
499 | (4) |
|
|
503 | (2) |
Index |
|
505 | |