Skip to content

This project demonstrates Python-based MySQL database interaction using mysql-connector for query execution and matplotlib for data visualization.

License

Notifications You must be signed in to change notification settings

larisanti/restaurant-db

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MySQL Restaurant Database & Python Analytics System

MySQL Workbench MySQL Connector/Python Python Matplotlib

This project combines a MySQL backend with Python analytics through MySQL Connector/Python to track operations from bookings to sales. Developed during Meta's Data Engineering course, the solution features 13 relational tables, connection pooling for performance, and automated Matplotlib visualizations.


Implementation Process

1. Database Architecture

  • Created the ER diagram.
  • Set up a MySQL instance in MySQL Workbench.
  • Implemented the database schema.

ERD

2. Database Connection

  • Established database connectivity using mysql-connector-python.
  • Configured secure connection parameters.
db_config = {
  'host': 'localhost',
  'user': '-------',  # Insert your username
  'password': '--------',  # Insert your password
  'database': 'restaurant_db'
}

# Connection handling with error management
try:
  conn = mysql.connector.connect(**db_config)
  cursor = conn.cursor()
  print("Successfully connected to database")
except mysql.connector.Error as err:
  print(f"Database connection failed: {err}")
  exit()

3. Query Execution

  • Executed queries to insert sample data.
  • Verified data integrity by counting records across tables.

4. Data Analysis

Generated visualizations using matplotlib.

Booking Activity by Hour

See more of the data analysis in the restaurant-analysis.ipynb file.


Built With

  • MySQL Workbench
  • MySQL Connector/Python
  • Python
  • Matplotlib

How to Run the Project

  1. Clone the repository:

    git clone https://github.com/larisanti/restaurant-db.git
    cd restaurant-db
  2. Install the required Python libraries:

    pip install mysql-connector-python matplotlib
  3. Set up the MySQL database:

    • Import the provided .sql file to create and populate the database.
    • Update your MySQL credentials for the database connection.

License

This project is licensed under the MIT License. For more details, see the LICENSE file.

About

This project demonstrates Python-based MySQL database interaction using mysql-connector for query execution and matplotlib for data visualization.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published