Skip to content
Skip to page content
soylai.com

Interface of Python with an SQL Database — Part 1: Connecting and Reading Data

Beta
Lesson

Python meets MySQL

Part 1 — connecting to a MySQL database and reading its rows from Python.

In this lesson you will

  • Explain how a Python program works with a MySQL database through mysql.connector
  • Connect to a database and create a cursor
  • Run SELECT queries with execute() and read rows with fetchone(), fetchall() and fetchmany()
Part 1 at a glance