Skip to content

A database that leverages MySQL and python to recommend users items that best fit there interests using the cosine similarity equation

Notifications You must be signed in to change notification settings

Andrew-most-likely/Movie-DB-CLI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŽ₯ Movie Recommendation CLI App

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.

erd

πŸ“¦ Features

  • 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.

πŸ–₯️ Setup Instructions

1️⃣ Install Dependencies

First ensure you have Python 3.11 or higher installed.

Then install the required Python libraries:

pip install sqlalchemy pymysql tabulate

2️⃣ Setup MySQL Database

Make 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.

3️⃣ Configure Database Connection

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"

πŸ“š How to Use the Application

Run the Python script from your terminal:

python movie_cli.py

You'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.

πŸ“ Notes

  • 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.

βœ… Requirements

  • Python 3.11
  • MySQL Server
  • Python Packages:
    • sqlalchemy
    • pymysql
    • tabulate

πŸ™ Big Thanks to...

  • 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

About

A database that leverages MySQL and python to recommend users items that best fit there interests using the cosine similarity equation

Topics

Resources

Stars

Watchers

Forks

Languages