MySQL Connector/Python Developer Guide / ... / Connector/Python API Reference / connection.MySQLConnection Class / MySQLConnection.cmd_query() Method
Syntax:
cnx.cmd_query(statement) This method sends the givenstatement to the MySQL server and returns a result. To send multiple statements, use thecmd_query_iter() method instead.
The returned dictionary contains information depending on what kind of query was executed. If the query is aSELECT statement, the result contains information about columns. Other statements return a dictionary containing OK or EOF packet information.
Errors received from the MySQL server are raised as exceptions. AnInterfaceError is raised when multiple results are found.
Returns a dictionary.