Pyodbc SQL CRUD — Read: Examples with MySQL

Josh Otwell
7 min readJan 15, 2020

Reading the data in a database table is a fundamental SQL operation. I suppose you could just store the data and be done with it. But, where is the fun in that? To see stored data, you use the SELECT command. In the CRUD acronym, that is the Read aspect. I have written extensively on SQL CRUD operations in the past (see list of posts at the end of this piece). But, how do you read rows of data with pyodbc as the middleware (termed loosely here) between you and the database? Keep reading to see several simple examples…

Photo by Shahadat Rahman on Unsplash

OS, Software, and DB used:

Self-Promotion:

If you enjoy the content written here, by all means, share this blog and your favorite post(s) with others who may benefit from or like it as well. Since coffee is my favorite drink, you can even buy me one if you would like!

Pyodbc CRUD Series

Visit other posts that are part of the Pyodbc CRUD series:

Below is the setup connection information I use throughout this post:

In [1]: import pyodbcIn [2]: conn = pyodbc.connect(“””DRIVER={MySQL ODBC 8.0 Unicode Driver};
…: SERVER=localhost;DATBASE=walking;USER=j2112o;PASSWORD=my_password;”””)

--

--

Josh Otwell
Josh Otwell

Written by Josh Otwell

SQL/PHP | Photography | Technical Consultant. Sign-up for my free developer newsletter, OpenLampTech, here: openlamptech.substack.com

No responses yet