From the course: Advanced SQL for Application Development

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Query with SQLAlchemy

Query with SQLAlchemy

From the course: Advanced SQL for Application Development

Start my 1-month free trial

Query with SQLAlchemy

- [Instructor] Hey, in this video we're going to take a look at what it's like to actually work with SQLAlchemy to query some of our tables. And in particular actually we'll just query one. We're going to take a look at working with the products table. So the first thing I want to do is import the libraries that we're going to need because we are working with Pythons. So we'll import some drivers here. First of all we'll import a driver for working with the PostgreSQL database and we'll use the same one we've used before and I'm also storing username and password in environment variables. So I'm going to get the operating system package as well so I can look those up. And then I'm going to get a few things from SQLAlchemy. So rather than import all of SQLAlchemy, I'm going to import just the stuff that I need. And the first thing I'm going to do is import the create engine function and create engine allows us to basically…

Contents