Python HOW: Connect to, and Manage a Database with SqlAlchemy and Pandas

Gabriel Harris Ph.D.
2 min readSep 24, 2020
Photo by panumas nikhomkhai from Pexels

This is an extension to a previous article 👀 that covers the low-level methods of establishing a connection to a SQL database and executing queries. We cover here the equivalent high-level methods in SqlAlchemy and Pandas to do the same in fewer lines of code

TL;DR: full code

Prerequisites

Install pyodbc, sqlalchemy and pandas using your preferred package manager

Then, install the required driver for the DBMS-database you want to connect to. For example, if you want to connect to a Microsoft SQL Server-Database, you need to download and install the driver from Microsoft, after choosing your operating system

For more details on pyodbc (Open DataBase Connectivity for Python) and DBMS (Database management system), 👀 the previous article

Creating a…

--

--

Gabriel Harris Ph.D.

I’m an End-to-End Lead Data Scientist and Data Science Manager. My articles are love letters to my future self