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.
- Created the ER diagram.
- Set up a MySQL instance in MySQL Workbench.
- Implemented the database schema.
- 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()
- Executed queries to insert sample data.
- Verified data integrity by counting records across tables.
Generated visualizations using matplotlib
.
See more of the data analysis in the restaurant-analysis.ipynb file.
- MySQL Workbench
- MySQL Connector/Python
- Python
- Matplotlib
-
Clone the repository:
git clone https://github.com/larisanti/restaurant-db.git cd restaurant-db
-
Install the required Python libraries:
pip install mysql-connector-python matplotlib
-
Set up the MySQL database:
- Import the provided
.sql
file to create and populate the database. - Update your MySQL credentials for the database connection.
- Import the provided
This project is licensed under the MIT License. For more details, see the LICENSE file.