Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Relational Databases With SQLAlchemy!
You have completed Relational Databases With SQLAlchemy!
Preview
Practice updating and deleting entries in a relational database.
Queries
lion = models.session.query(models.Animal).filter(models.Animal.name=="lion").first()
wombat = models.session.query(models.Animal).filter(models.Animal.name=="wombat").first()
lion_log = models.session.query(models.Logbook).filter(models.Logbook.animal_id==1).first()
seal_log = models.session.query(models.Logbook).filter(models.Logbook.animal_id==2).first()
SQLAlchemy Docs
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
how these actions may change
when working with relationships.
0:00
If you closed your project, don't forget
to reactivate your virtual environment and
0:01
then pop back into the Python shell.
0:06
And go ahead and import models.
0:10
Let's create some variables to
hold the entries we have so
0:14
far to make things a bit easier.
0:17
I'm gonna run a few queries that are also
in the teacher's notes to speed things up.
0:20
So lion =, and
0:25
I'm gonna copy-paste to make this
a little bit easier on myself as well.
0:26
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up