Book description
Integrating MySQL and Python can bring a whole new level of productivity to your applications. This practical tutorial shows you how with examples and explanations that clarify even the most difficult concepts.
- Implement the outstanding features of Python's MySQL library to their full potential
- See how to make MySQL take the processing burden from your programs
- Learn how to employ Python with MySQL to power your websites and desktop applications
- Apply your knowledge of MySQL and Python to real-world problems instead of hypothetical scenarios
- A manual packed with step-by-step exercises to integrate your Python applications with the MySQL database server
In Detail
Python is a dynamic programming language, which is completely enterprise ready, owing largely to the variety of support modules that are available to extend its capabilities. In order to build productive and feature-rich Python applications, we need to use MySQL for Python, a module that provides database support to our applications. Although you might be familiar with accessing data in MySQL, here you will learn how to access data through MySQL for Python efficiently and effectively.
This book demonstrates how to boost the productivity of your Python applications by integrating them with the MySQL database server, the world's most powerful open source database. It will teach you to access the data on your MySQL database server easily with Python's library for MySQL using a practical, hands-on approach. Leaving theory to the classroom, this book uses real-world code to solve real-world problems with real-world solutions.
The book starts by exploring the various means of installing MySQL for Python on different platforms and how to use simple database querying techniques to improve your programs. It then takes you through data insertion, data retrieval, and error-handling techniques to create robust programs. The book also covers automation of both database and user creation, and administration of access controls. As the book progresses, you will learn to use many more advanced features of Python for MySQL that facilitate effective administration of your database through Python. Every chapter is illustrated with a project that you can deploy in your own situation.
By the end of this book, you will know several techniques for interfacing your Python applications with MySQL effectively so that powerful database management through Python becomes easy to achieve and easy to maintain.
A practical manual packed with step-by-step examples to manage your MySQL database efficiently through Python
Table of contents
-
MySQL for Python
- Table of Contents
- MySQL for Python
- Credits
- About the Author
- About the Reviewers
- Preface
-
1. Getting Up and Running with MySQL for Python
- Getting MySQL for Python
- Importing MySQL for Python
- Connecting with a database
- Multiple database connections
- Summary
- 2. Simple Querying
-
3. Simple Insertion
- Forming a MySQL insertion statement
- Helpful ways to nuance an INSERT statement
- Passing an insertion through MySQL for Python
- Using user-defined variables
- Using metadata
- Changing insertion values dynamically
- Essentials: close and commit
-
Project: A command-line insertion utility
- The necessary modules
-
The main() thing
- Coding the flag system
- Testing the values passed by the user
- Try to establish a database connection
- Showing the tables
- Showing the table structure, if desired
- Accepting user input for the INSERT statement
- Building the INSERT statement from the user input and executing it
- Committing changes and closing the connection
- Coding the other functions
- Calling main()
- Room to grow
- Summary
- 4. Exception Handling
- 5. Results Record-by-Record
- 6. Inserting Multiple Entries
-
7. Creating and Dropping
- Creating databases
- Removing or deleting databases
- Creating tables
- Dropping tables
- Doing it in Python
- Dropping tables with MySQLdb
- Project: Web-based administration of MySQL
- Summary
- 8. Creating Users and Granting Access
- 9. Date and Time Values
- 10. Aggregate Functions and Clauses
- 11. SELECT Alternatives
- 12. String Functions
- 13. Showing MySQL Metadata
- 14. Disaster Recovery
- Index
Product information
- Title: MySQL for Python
- Author(s):
- Release date: September 2010
- Publisher(s): Packt Publishing
- ISBN: 9781849510189
You might also like
video
Using MySQL Databases with Python
Today databases are highly valued as they allow users to effectively manage, access, and update data. …
book
MySQL Connector/Python Revealed: SQL and NoSQL Data Storage Using MySQL for Python Programmers
Move data back and forth between database and application. The must-have knowledge in this book helps …
book
Introducing MySQL Shell: Administration Made Easy with Python
Use MySQL Shell, the first modern and advanced client for connecting to and interacting with MySQL. …
book
MySQL Cookbook
While MySQL has turned up among high profile users such as Yahoo!, NASA and the U.S. …