From the course: Advanced Python: Working with Databases
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Manipulating with Postgres data using SQLAlchemy Core - Python Tutorial
From the course: Advanced Python: Working with Databases
Manipulating with Postgres data using SQLAlchemy Core
- [Instructor] With the setup complete, let's walk through how to establish a connection to a Postgres database using SQL Alchemy Core. Engine dot connect creates a connection with the database. Inside the connection, we run a bunch of CRUD statements. CRUD stands for create, read, update, and delete. These are the main operations you'll run as you manipulate data in any database. Let's start with read. We pass in the sales table to a select statement and then select all the rows in the table. For each row, we print it out. Then we add a new piece of data to the database. It's a sale of a few books called "Understanding Artificial Intelligence." Now, let's say the buyer, Syman Mapstone, gets the books in the mail and one of them has a few pages ripped out. We'd need to update the sales table so he gets a refund for the ruined book. We do that here with an update statement. We say, update the table where the order…
Contents
-
-
-
-
-
-
What is PostgreSQL?2m 37s
-
(Locked)
Creating a PostgreSQL database2m 20s
-
(Locked)
Creating a table in Postgres using Python2m 17s
-
(Locked)
Inserting data into a Postgres database2m 6s
-
(Locked)
Interacting with a Postgres database using Python3m 40s
-
(Locked)
Setting up SQLAlchemy Core to connect to a Postgres database2m 51s
-
(Locked)
Manipulating with Postgres data using SQLAlchemy Core2m 50s
-
(Locked)
Setting up SQLAlchemy ORM to connect to a Postgres database1m 21s
-
(Locked)
Manipulating with Postgres data using SQLAlchemy ORM2m 51s
-
(Locked)
Challenge: Create a Postgres database2m 7s
-
(Locked)
Solution: Create a Postgres database6m 41s
-
-