Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Mysql and Python Project

Download as pdf or txt
Download as pdf or txt
You are on page 1of 35

lOMoARcPSD|48030544

Mysql and python project

computer science engineering (Amrita Vishwa Vidyapeetham)

Scan to open on Studocu

Studocu is not sponsored or endorsed by any college or university


Downloaded by RISHAV JHA (rishavjham090@gmail.com)
lOMoARcPSD|48030544

COMPUTER SCIENCE PROJECT

TO DO LIST AND REMINDER

Submitted by
C.GANESH
XII-B1

AMRITA VIDYALAYAM
NALLAMPALAYAM, COIMBATORE
2023-2024

AMRITA VIDYALAYAM

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

NALLAMPALAYAM, COIMBATORE

CERTIFICATE

This is to certify that the project titled TO DO LIST AND REMINDER


was completed by Master C.GANESH Reg. No. _____________of
Class XII under my guidance and supervision within the stipulated time
as prescribed by the CBSE for AISSCE Computer Science Practical
Examination, 2023 – 2024 held at “Amrita Vidyalayam,
Nallampalayam, Coimbatore District”.

TEACHER INCHARGE

Mrs. LathaRamaswamy M.E.,

Department of Computer Science,

Amrita Vidyalayam,

Nallampalayam

INTERNAL EXAMINER EXTERNAL EXAMINER PRINCIPAL

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

ACKNOWLEDGEMENT

I would like to express my special thanks of gratitude to our


honourable Correspondent Brahmacharini. Mukta Amrita Prana as
well as our Academic Director Mrs. SP. Visalakshi M.A, B.Ed, and
Principal Mrs. B.Padmaja M.C.A, B.Ed, who gave us the golden
opportunity to do this wonderful project. This project helped us in doing
a lot of research and we came to know about so many new things. I am
really thankful to them.

Secondly, we acknowledge our sincere thanks to our Computer


Science teacher Mrs. Latha Ramaswamy M.E, Department of
Computer Science for her guidance, advice and supervision.

Finally, I would also like to thank my parents and friends who


helped me in the completion of this project.

Signature of the Student.

Name in upper case

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

INDEX

 About Python
 About MYSQL
 Synopsis
 Project Overview/Description
 System Requirements
 Backend Details
 Python Packages And Functions Used
 Source Code
 Output Screenshots
 User Manual
 Future Enhancements
 Bibliography
 Conclusion

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

ABOUT PYTHON

Python is a dynamic, high-level, free open source, and interpreted


programming language. It supports object-oriented programming as well
as procedural-oriented programming.

Features in Python :

1. Free and Open Source

2. Easy to code

3. Easy to Read

4. Object-Oriented Language

5. GUI Programming Support

6. High-Level Language

7. Large Community Support

8. Easy to Debug

9. Python is a Portable language

10. Python is an integrated language

11. Interpreted Language:

12. Large Standard Library

13. Dynamically Typed Language


5

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

14. Frontend and backend development

15. Allocating Memory Dynamically

Advantages of Python Programming Language

 Easy to read, learn and code


 Dynamic Typing
 Free, Open Source
 Portable
 Extensive Third-Party Libraries
 Wide Range of Applications
 Extensible and Integrable to Other Programming Languages
 Interpreted Language
 Functional, Object-Oriented, and Procedural
 Involvement in Large Projects.
 Memory Management

Disadvantages of Python :

 It’s Simple in Nature


 Slow Speed and Memory Inefficient
 Weak Mobile Computation
 Poor Database Access
6

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

ABOUT MYSQL

MySQL is the world’s most popular open source database.


According to DB-Engines, MySQL ranks as the second-most-popular
database, behind Oracle Database. MySQL powers many of the most
accessed applications, including Facebook, Twitter, Netflix, Uber,
Airbnb, Shopify, and Booking.com. Since MySQL is open source, it
includes numerous features developed in close cooperation with users
over more than 25 years. So it’s very likely that your favorite
application or programming language is supported by MySQL
Database.

MySQL is a Relational Database Management System

SQL is the most common standardized language used to access


databases. Depending on user’s programming environment, user might
enter SQL directly (for example, to generate reports), embed SQL
statements into code written in another language, or use a language-
specific API that hides the SQL syntax.

MySQL is a Open Source

Open source means it’s possible for anyone to use and modify the
software. Anybody can download MySQL software from the internet
and use it without paying for it. User can also change its source code to
suit your needs.

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

MySQL: the #1 Choice for developers

Developers like its high performance, reliability, and ease of use.


MySQL supports the following popular development languages and
drivers:

PHP Python Java/JDBC Node.js


Perl Ruby Go Rust
C C++ C#/.NET ODBC

MySQL has also become the database of choice for many of the most
successful open source applications, including WordPress, Drupal,
Joomla, and Magento.

MySQL works in client/server or embedded systems

MySQL Database is a client/server system that consists of a


multithreaded SQL server that supports different back ends, several
different client programs and libraries, administrative tools, and a wide
range of application-programming interfaces (APIs).

MySQL Benefits

MySQL is fast, reliable, scalable, and easy to use. It was originally


developed to handle large databases quickly and has been used in
highly demanding production environments for many years.

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

MySQL’s key benefits include

 Ease of use
 Reliability
 Scalability
 Performance
 High availability
 Security
 Flexibility

Establishing a Connection with MySQL Server

MySQL is a server-based database management system. One server


might contain multiple databases. To interact with a database, you must
first establish a connection with the server. The general workflow of a
Python program that interacts with a MySQL-based database is as
follows:

1. Connect to the MySQL server.


2. Create a new database.
3. Connect to the newly created or an existing database.
4. Execute a SQL query and fetch results.
5. Inform the database if any changes are made to a table.
6. Close the connection to the MySQL server.

This is a generic workflow that might vary depending on the individual


application. But whatever the application might be, the first step is to
connect your database with your application.

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

PROJECT SYNOPSIS

The problem definition for the project is to create a To-Do List Manager
that utilizes a MySQL database for task storage. The application allows
users to perform various operations, such as adding tasks with titles,
descriptions, and due dates, listing all tasks, setting reminders for
upcoming tasks, marking tasks as completed, and updating task titles
and due dates. The goal is to provide users with a simple and interactive
tool for managing their tasks effectively.

Advantages of the proposed system :


The proposed To-Do List Manager system offers several advantages:

1. Database Integration (MySQL) : Utilizing MySQL for data storage


ensures structured and organized task management, enabling efficient
retrieval and manipulation of task information.

2. User-Friendly Interface: The program provides a straightforward


menu-driven interface, making it easy for users to interact with the
application and perform various task management actions.

3. Task Details: Users can add detailed information about tasks,


including titles, descriptions, due dates, and completion status,
facilitating comprehensive task tracking.

10

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

4. Reminder Functionality: The system includes a reminder feature,


helping users stay on top of upcoming tasks by notifying them based on
due dates.

5. Task Status Tracking: Users can mark tasks as completed, providing


a clear visual indication of their progress and helping them stay
organized.

6. Task Updating: The system allows users to update task titles and due
dates, accommodating changes and modifications to task details.

7. Structured Code: The code is organized into functions, enhancing


readability and maintainability. The use of functions for different
operations promotes code reusability.

8. Clean-Up Process: The system closes the MySQL cursor and


connection after the user exits, ensuring proper resource management
and preventing potential issues related to open connections.

Overall, the proposed system aims to enhance task management


efficiency, user experience, and data integrity.

11

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

Project Description

The To-Do List Manager project is a simple yet effective task


management application designed to help users organize and track their
tasks. Here is a brief project description:

Project Overview:
The To-Do List Manager is a Python-based application that employs a
MySQL database for storing and managing tasks. Users can interact
with the system through an intuitive menu, performing various
operations such as adding tasks, listing existing tasks, setting reminders,
marking tasks as completed, and updating task details.

Key Features:
1. Add Tasks: Users can input task titles, descriptions, and due dates to
add new tasks to the system.

2. List Tasks: The application displays a comprehensive list of all tasks,


providing users with an overview of their to-do items.

3. Set Reminders: A reminder feature notifies users of upcoming tasks,


helping them stay organized and on schedule.

12

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

4. Mark Tasks as Completed: Users can indicate task completion,


providing a visual representation of their progress.

5. Update Task Details: The system allows users to modify task titles
and due dates, adapting to changing priorities.

Technology Stack:
- Programming Language: Python

- Database: MySQL

- Library: mysql.connector

- Date and Time Handling: datetime module

User Interface:
The application features a user-friendly menu-driven interface, allowing
users to easily navigate and perform desired actions.

Code Structure:
The code is organized into functions, enhancing readability and
facilitating code reuse. Proper resource management ensures the closure
of database connections.

13

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

SYSTEM REQUIREMENTS

Minimum Hardware Requirements:

- Display: LED Monitor or above

- Processor: Pen琀椀um core or above

- Hard Disk: 100 GB

- RAM: 1 GB

- Keyboard: PS/2 or USB

- Mouse: PS/2 or USB

So昀琀ware Requirements:

- Opera琀椀ng System: Windows 8 or above

- Python IDE: Version 3.6 or above

- MySQL Server: Version 8.0 or above

14

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

BACK END DETAILS

BACK END : MYSQL SERVER


It provides a database management system with
querying and connectivity capabilities, as well as
the ability to have excellent data structure and
integration with many different platforms.

It can handle large databases and quickly in high


demanding production environments.

Database Name : todo_db


Details : Table Name: tasks

15

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

PACKAGES & FUNCTIONS USED


IN THE PROJECT

PACKAGE / MODULE

Mysql.connector: Provides connectivity between


mysql server and python program.
Datetime: It is used in this software to provide date
and time.

USER DEFINED FUNCTIONS

Menu: this function displays the main menu of the


application , allowing user to choose from various
actions.

Display_reminders(): reminders are implemented as


part of the project , this function display reminders to
the user at the appropriate times

List_tasks(cursor):this function lists all tasks


stored in the database.

Delete_task(cursor,task_id):function deletes a task


from the database based on the task id given by the
user

16

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

Source code

17

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

import mysql.connector

import datetime

# MySQL Configuration

config = {

"host": "localhost",

"user": "root",

"password": "flash",

"database": "todo_db",

# Connect to MySQL

conn = mysql.connector.connect(**config)

cursor = conn.cursor()

# Function to Add a Task

def add_task(title, description, due_date):

18

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

sql = "INSERT INTO tasks (title, description, due_date, completed)


VALUES (%s, %s, %s, %s)"

values = (title, description, due_date, False)

cursor.execute(sql, values)

conn.commit()

# Function to Add a Task

def add_task(title, description, due_date):

sql = "INSERT INTO tasks (title, description, due_date, completed)


VALUES (%s, %s, %s, %s)"

values = (title, description, due_date, False)

cursor.execute(sql, values)

conn.commit()

# Function to List Tasks

def list_tasks():

sql = "SELECT * FROM tasks"

cursor.execute(sql)

tasks = cursor.fetchall()

if not tasks:
19

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

print("No tasks found.")

else:

print("\nAll Tasks:")

for task in tasks:

print(f"Task {task[0]} - Title: {task[1]}, Description: {task[2]},


Due Date: {task[3]}, Completed: {task[4]}")

# Function to Set a Reminder

def set_reminder(task_id):

current_time = datetime.datetime.now()

sql = "SELECT title, due_date FROM tasks WHERE id = %s"

cursor.execute(sql, (task_id,))

task = cursor.fetchone()

if task:

task_title, due_date = task

if due_date > current_time:

print(f"Reminder: Task '{task_title}' is due at {due_date}.")

else:

20

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

print(f"Task '{task_title}' is already overdue.")

# Function to Mark Task as Completed

def mark_task_completed(task_id):

sql = "UPDATE tasks SET completed = True WHERE id = %s"

cursor.execute(sql, (task_id,))

conn.commit()

print("Task marked as completed.")

# Function to Update Task Title and Due Date

def update_task(task_id, new_title, new_due_date):

sql = "UPDATE tasks SET title = %s, due_date = %s WHERE id =


%s"

cursor.execute(sql, (new_title, new_due_date, task_id))

conn.commit()

print("Task updated successfully.")

# Main Menu

21

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

while True:

print("\nTo-Do List Menu:")

print("1. Add a Task")

print("2. List Tasks")

print("3. Set Reminder")

print("4. Mark Task as Completed")

print("5. Update Task Title and Due Date")

print("6. Exit")

choice = input("Enter your choice: ")

if choice == "1":

title = input("Enter task title: ")

description = input("Enter task description: ")

due_date = input("Enter due date and time (YYYY-MM-DD


HH:MM): ")

add_task(title, description, due_date)

print("Task added successfully!")

22

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

elif choice == "2":

list_tasks()

elif choice == "3":

task_id = int(input("Enter the ID of the task for which you want to


set a reminder: "))

set_reminder(task_id)

elif choice == "4":

task_id = int(input("Enter the ID of the task to mark as completed:


"))

mark_task_completed(task_id)

elif choice == "5":

task_id = int(input("Enter the ID of the task you want to update: "))

new_title = input("Enter the new title: ")

new_due_date = input("Enter the new due date and time (YYYY-


MM-DD HH:MM): ")

23

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

update_task(task_id, new_title, new_due_date)

elif choice == "6":

break

# Clean up

cursor.close()

conn.close()

24

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

SCREENSHOTS

Main menu:

Add task:

25

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

List tasks:

Set reminder :

Mark task as completed:


26

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

To-Do Reminder - User Manual

27

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

1. Installation:
- Ensure you have Python installed on your system.

- Install the mysql-connector-python library using pip install mysql-


connector-python.

2. Setup:
- Make sure your MySQL server is running.

- Modify the config dictionary in the code with your MySQL server
details.

3. Running the Program:


- Execute the Python script in your preferred environment.

4. Main Menu:
- The program will present a menu with the following options:

- *1. Add a Task:* Enter task details to add a new task.

- *2. List Tasks:* Display a list of all tasks.

- *3. Set Reminder:* Set reminders for upcoming tasks.

- *4. Mark Task as Completed:* Mark tasks as completed.

- *5. Update Task:* Modify task titles and due dates.

28

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

- *6. Exit:* Terminate the program.

5. Adding a Task:
- Choose option 1 from the menu.

- Enter the task title, description, and due date as prompted.

6. Listing Tasks:
- Choose option 2 from the menu.

- All tasks will be displayed with their details.

7. Setting Reminders:

- Choose option 3 from the menu.

- Enter the task ID to set a reminder for.

8. Marking Task as Completed:

- Choose option 4 from the menu.

- Enter the task ID to mark as completed.

9. Updating a Task:

29

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

- Choose option 5 from the menu.

- Enter the task ID and provide the new title and due date.

10. Exiting the Program:

- Choose option 6 from the menu to exit the program.

11. Clean-Up:

- The program automatically closes database connections upon exit.

Note: Ensure your MySQL server is configured correctly and accessible


from the Python environment.

This user manual provides a step-by-step guide for interacting with the
To-Do List Manager. Follow the instructions to efficiently manage your
tasks and stay organized.

30

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

Future enhancements

1. User Authentication:

- Implement user accounts and authentication for personalized task


management.

2. Task Categories and Prioritization:

- Allow users to categorize tasks and set priorities for better


organization.

3. Search and Filtering:

- Incorporate search and filtering options to quickly locate specific


tasks.

4. Mobile Application:

- Develop a mobile app for on-the-go task management and reminders.

5. Collaboration Features:

- Enable collaboration by allowing users to share tasks or assign them


to others.

31

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

6. Recurring Tasks:

- Add functionality for recurring tasks with customizable intervals.

7. Data Analytics:

- Implement basic analytics to provide insights into task completion


patterns.

8. Integration with Calendar:

- Integrate the application with calendar tools for seamless scheduling.

9. Notifications:

- Enhance reminder notifications with customizable settings.

10. Data Backup and Restore:

- Provide options for users to back up and restore their task data.

11. Dark Mode:

- Include a dark mode option for users who prefer a different visual
style.

12. Voice Commands: - Integrate voice recognition for hands-free task


management.
32

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

BIBLIOGRAPHY

TEXT BOOKS

1. Computer Science with Python: Sumitha Arora

2. Computer Science with Python: Preeti Arora

Web Sites

➢www.cbseprojectguide.com
➢www.python4csip.com
➢www.codewithfaraz.com

33

Downloaded by RISHAV JHA (rishavjham090@gmail.com)


lOMoARcPSD|48030544

Conclusion

The To-Do List Reminder project offers a practical solution for


individuals seeking a straightforward and efficient way to organize and
track their tasks. The integration of a MySQL database provides a
structured approach to task management, while the user-friendly
interface and comprehensive set of features contribute to a positive user
experience.

The ability to add, list, update, and mark tasks as completed enhances
the flexibility of the system, accommodating changes in priorities and
reflecting the user's progress. The reminder feature adds a proactive
element to task management, helping users stay on top of upcoming
deadlines.

The clean and readable code structure, along with proper resource
management, ensures the reliability and maintainability of the
application. Users can navigate the menu-driven interface with ease,
making the To-Do List Manager a practical tool for daily task
organization.

Overall, this project demonstrates a successful implementation of a To-


Do List Manager, providing a valuable resource for individuals seeking
a simple yet effective solution for managing their tasks efficiently.

34

Downloaded by RISHAV JHA (rishavjham090@gmail.com)

You might also like