更新时间:2021-04-13 17:12:48
封面
版权页
Credits
About the Author
About the Reviewers
Preface
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Chapter 1. Getting Up and Running with MySQL for Python
Importing MySQL for Python
Connecting with a database
Multiple database connections
Summary
Chapter 2. Simple Querying
Forming a query in MySQL
Passing a query to MySQL
Using user-defined variables
Determining characteristics of a database and its tables
Changing queries dynamically
Project: A command-line search utility
Room to grow
Chapter 3. Simple Insertion
Helpful ways to nuance an INSERT statement
Passing an insertion through MySQL for Python
Using metadata
Changing insertion values dynamically
Essentials: close and commit
Project: A command-line insertion utility
Chapter 4. Exception Handling
Errors versus warnings: There's a big difference
The two main errors in MySQLdb
Warnings in MySQL for Python
Handling exceptions passed from MySQL
Catching different types of exceptions
Creating a feedback loop
Project: Bad apples
Chapter 5. Results Record-by-Record
Why?
How?
Project: A movie database
Chapter 6. Inserting Multiple Entries
Introducing the executemany() method
executemany(): Basic syntax
executemany(): Behind the scenes
Project: Converting a CSV file to a MySQL table
Chapter 7. Creating and Dropping
Removing or deleting databases
Creating tables
Dropping tables
Doing it in Python
Dropping tables with MySQLdb
Project: Web-based administration of MySQL
Chapter 8. Creating Users and Granting Access
Creating users in MySQL
Creating users from Python
Removing users in MySQL
DROPping users in Python
GRANT access in MySQL
Granting access in Python
Removing privileges in MySQL
Using REVOKE in Python
Project: Web-based user administration
Chapter 9. Date and Time Values
Date and time types in Python
Date and time functions
Project: Logging user activity
Chapter 10. Aggregate Functions and Clauses
Trimming results
Server-side sorting in MySQL
Putting it in Python
Project: Incorporating aggregate functions
Chapter 11. SELECT Alternatives
Subqueries
Unions
Joins
Project: Implement HAVING
Chapter 12. String Functions
Accessing and using index data
Nuancing data
Project: Creating your own functions
Chapter 13. Showing MySQL Metadata
Accessing database metadata
Accessing user metadata
Project: Building a database class