A simple CLI application built with Python SQLAlchemy MySQL and Tabulate to manage users movies and reviews. Aditionally it uses collaborative filtering to generate basic movie recommendations using a stored procedure.
- Add new users and movies.
- Search for movies by name.
- Submit movie reviews.
- Generate movie recommendations for a user based on collaborative filtering.
- Clean CLI-driven menu interface.
First ensure you have Python 3.11 or higher installed.
Then install the required Python libraries:
pip install sqlalchemy pymysql tabulateMake sure MySQL Server is running.
Use the provided SQL statements (from Data Base Setup) to:
- Create the movie_db database.
- Create the User, Movie, and Review tables.
- Create the GetRecommendations stored procedure.
- Insert sample data into the database.
In the provided Python Program, update the DATABASE_URL with your database credentials:
DATABASE_URL = "mysql+pymysql://<username>:<password>@localhost/movie_db"Example:
DATABASE_URL = "mysql+pymysql://root:12345@localhost/movie_db"Run the Python script from your terminal:
python movie_cli.pyYou'll see a CLI menu:
--- Movie CLI ---
1. Add User
2. Add Movie
3. Search Movie
4. Submit Review
5. Get Recommendations
6. Exit
- Add User β Add a new user to the system.
- Add Movie β Add a new movie record.
- Search Movie β Search for a movie by name.
- Submit Review β Submit a review with a rating for a movie by a user.
- Get Recommendations β Get top 5 recommended movies for a user based on other users.
- Exit β Exit the application.
- Ratings are on a scale from 1 to 10 when submitting reviews.
- The stored procedure runs a form of Collaborative Filtering for meaningful recommendations.
- Error handling is implemented for database connection and stored procedure execution.
- Python 3.11
- MySQL Server
- Python Packages:
- sqlalchemy
- pymysql
- tabulate
- Chompunoot Keeratitechakorn
- I Used her article to help inform my algorithm of choice
- Vatsal
- I used his python implimentation to inform my formatting
- Davide Mauri
- I adapted his sql version of the cosine similarity function for this project
