Project Challenge: Create User and Pet Models
In this challenge, we will be initializing a database connection and creating the User and Pet models in the project application.
We'll cover the following
Problem statement #
Up until now, we have been using lists of dictionaries to store the information related to users and pets in our project. However, now that we have learned how to use the database, we can create models for these entities instead.
Therefore, in this challenge, you will complete the following tasks:
- Initiate a database connection with an
SQLite
database. - Create models called
Pet
andUser
to store the data that we previously stored in the lists. - The
email
column of theUser
model and thename
column of thePet
model should contain theunique
constraint on them. - Create the tables in the database associated with the models.
Get hands-on with 1400+ tech skills courses.