© Jesper Wisborg Krogh 2018
Jesper Wisborg KroghMySQL Connector/Python Revealedhttps://doi.org/10.1007/978-1-4842-3694-9_3

3. Basic Query Execution

Jesper Wisborg Krogh1 
(1)
Hornsby, New South Wales, Australia
 

The previous chapter discussed how to connect to MySQL from the Python program. However, there is not much point in creating a connection just to get a connection ID or do nothing. The whole point of MySQL Connector/Python, after all, is to execute queries. This chapter will look at the basics of query execution.

First, you will learn how to execute queries using the cmd_query() method of the connection object. Then you will explore the more advanced concept of cursors. Lastly, you’ll see how to handle user input.

Tip

There are a number of example ...

Get MySQL Connector/Python Revealed: SQL and NoSQL Data Storage Using MySQL for Python Programmers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.