HARDWARE AND SOFTWARE REQUIRED
HARDWARE
1. PC
2. Mobile Phone
SOFTWARE
1. Python (latest version)
2. MYSQL
3. Python Connector
1
CONTENT
● Introduction
● About Python
● About Mysql with Python
● Source Code
● Sample Output
● Bibiliography
2
Introduction about the Marriage Bureau Management System
This project is a simplified version of a Marriage Bureau Management System
in Python, and it covers the basics of working with a MySQL database.
1. Database Setup:
A database is like a structured Excel sheet that stores information. In this
project, we use MySQL, a popular database system.
We set up a database called “marriage_bureau_management” to store
information about users and customers looking for marriage partners.
2. User Registration and Login:
Users (people looking for marriage partners) can register with a username
and password. This information is stored in the “user_id” table.
Users can log in using their registered username and password. If they
provide the correct details, they can access the system.
3. Customer Details:
Users can add details about people who are looking for marriage partners.
This includes their name, address, caste, appearance, age, profession, and
phone number.
This information is stored in the “customer_details” table.
4. Searching for Matches:
Users can search for potential matches based on two criteria: profession and
appearance.
If you’re looking for someone with a specific job (like a doctor or engineer),
you can search for matches by their profession.
If you’re looking for someone who looks a certain way (beautiful,
handsome, etc.), you can search for matches by their appearance.
The system will display matching profiles based on the criteria you provide.
3
5. Menu and Interaction:
The project provides a simple menu for users with options like registration,
login, adding customer details, and searching for matches.
Users can choose from these options and interact with the system.
6. Error Handling:
The project includes some basic error handling to check for duplicate user
registrations and provides feedback to the user.
7. Database Interaction:
The program interacts with the MySQL database using Python. It uses SQL
queries to store and retrieve data.
8. Structure:
The code is organized into functions, which makes it easier to understand
and maintain. Functions like “register_user” and “login_user” handle
specific tasks.
This project is a simplified example of a larger system that a marriage bureau
might use to manage profiles and match potential partners. It’s designed to help
students learn the basics of database interaction, user authentication, and data
retrieval.
Students can explore and expand on this project by adding more features,
improving the user interface, and enhancing the database structure to make it more
practical and robust.
4
About Python Programming Language
Python is a high-level, general-purpose programming language known for its
readability and simplicity. It was created by Guido van Rossum and first released in
1991. Python supports multiple programming paradigms, including object-oriented,
procedural, and functional programming.
Key Features and Design Philosophy
Python's design philosophy emphasizes code readability and simplicity. It uses
significant indentation to define code blocks, making the code visually uncluttered
and easy to read. Python is dynamically typed and garbage-collected, supporting
dynamic name resolution
Python is often described as a "batteries included" language due to its
comprehensive standard library, which covers various tasks such as web
development, data analysis, and system scripting. The language's core philosophy is
summarized in the Zen of Python (PEP 20), which includes aphorisms like
"Beautiful is better than ugly" and "Readability counts"
Practical Applications
Python is widely used in various domains, including:
Web Development: Frameworks like Django, Flask, and Pyramid facilitate
the creation of web applications.
Data Science and Machine Learning: Libraries such as NumPy, SciPy, Pandas,
TensorFlow, and scikit-learn make Python a popular choice for data analysis
and machine learning.
Automation and Scripting: Python's simple syntax and powerful libraries
make it ideal for automating repetitive tasks and writing scripts1.
Scientific Computing: Tools like SciPy and IPython support scientific
research and numerical computations.
5
Software Development: Python is used for developing software applications,
including GUI applications with libraries like Tkinter and PyQt5
About MYsql with Python
MySQL and Python are often used together to create powerful and efficient
database-driven applications. Here are some key purposes of using MySQL with
Python:
Data Storage and Retrieval:
MySQL provides a robust and scalable database management system to store large
amounts of data.
Python, with libraries like mysql-connector-python or PyMySQL, allows you to
interact with MySQL databases to perform CRUD (Create, Read, Update, Delete)
operations seamlessly.
Data Analysis and Reporting:
Python's powerful data analysis libraries, such as pandas and numpy, can be used to
analyze data stored in MySQL databases.
You can fetch data from MySQL, process it in Python, and generate insightful
reports or visualizations using libraries like matplotlib or seaborn.
Web Development:
Python web frameworks like Django and Flask can be integrated with MySQL to
build dynamic web applications.
MySQL serves as the backend database to store user data, application settings, and
other essential information, while Python handles the business logic and user
interface.
6
Automation and Scripting:
Python scripts can automate repetitive database tasks such as backups, data
migration, and batch processing.
Using MySQL with Python, you can write scripts to automate data entry, update
records, or generate periodic reports.
Machine Learning and AI:
MySQL can store large datasets required for training machine learning models.
Python, with its extensive machine learning libraries like scikit-learn and
TensorFlow, can retrieve data from MySQL, train models, and store results back into
the database.
By combining the strengths of MySQL and Python, developers can create efficient,
scalable, and maintainable applications that leverage the power of both technologies.
7
SOURCE CODE:
import mysql.connector as sql
# Connect to the MySQL database
conn = sql.connect(host='localhost', user='root', password='admin')
c1 = conn.cursor()
c1.execute(" create database if not exists marriage_bureau_management")
c1.execute("use marriage_bureau_management")
def create_tables():
# Create tables for customer details and user accounts
c1.execute('''
CREATE TABLE IF NOT EXISTS user_id (
id INT AUTO_INCREMENT PRIMARY KEY,
user_name VARCHAR(255),
password VARCHAR(255)
''')
c1.execute('''
CREATE TABLE IF NOT EXISTS customer_details (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(200),
address VARCHAR(100),
caste VARCHAR(100),
appearance VARCHAR(100),
age INT,
8
profession VARCHAR(255),
phone_no BIGINT
''')
conn.commit()
def register_user():
name = input('Enter your Username: ')
passwd = input('Enter your Password (only numbers): ')
# Insert user data into the 'user_id' table using a parameterized query
sql_insert = "INSERT INTO user_id (user_name, password) VALUES (%s, %s)"
user_data = (name, passwd)
try:
c1.execute(sql_insert, user_data)
conn.commit()
print('User created successfully')
except sql.IntegrityError as e:
print('User already exists.')
def login_user():
name = input('Enter your Username: ')
passwd = input('Enter your Password: ')
# Select user data from the 'user_id' table using a parameterized query
sql_select = "SELECT * FROM user_id WHERE user_name = %s AND password = %s"
user_data = (name, passwd)
9
c1.execute(sql_select, user_data)
result = c1.fetchone()
if result:
print('Login successful')
return result[0] # Return the user's ID
else:
print('Invalid username or password')
return None
def add_customer_details():
name = input('Enter the name: ')
address = input('Enter the address: ')
caste = input('Enter the caste: ')
appearance = input('Enter the appearance: ')
age = int(input('Enter the age: '))
profession = input('Enter the profession: ')
phone_no = int(input('Enter the phone number: '))
# Insert customer data into the 'customer_details' table using a parameterized query
sql_insert = "INSERT INTO customer_details (name, address, caste, appearance, age,
profession, phone_no) VALUES (%s, %s, %s, %s, %s, %s, %s)"
customer_data = (name, address, caste, appearance, age, profession, phone_no)
try:
c1.execute(sql_insert, customer_data)
conn.commit()
print('Customer details added successfully')
10
except Exception as e:
print('Error:', e)
def search_matches_by_profession(profession):
# Select customer data from the 'customer_details' table based on the profession
sql_select = "SELECT * FROM customer_details WHERE profession = %s"
c1.execute(sql_select, (profession,))
results = c1.fetchall()
if results:
print("Matching customers:")
for result in results:
print(result)
else:
print('No matching customers found.')
def search_matches_by_appearance(appearance):
# Select customer data from the 'customer_details' table based on appearance
sql_select = "SELECT * FROM customer_details WHERE appearance = %s"
c1.execute(sql_select, (appearance,))
results = c1.fetchall()
if results:
print("Matching customers:")
for result in results:
print(result)
else:
print('No matching customers found.')
11
def main_menu():
print('******************MARRIAGE BUREAU MANAGEMENT*************')
print('1. Register')
print('2. Login')
print('3. Add Customer Details')
print('4. Search Matches by Profession')
print('5. Search Matches by Appearance')
print('6. Exit')
while True:
choice = int(input('Enter your choice:'))
if choice == 1:
register_user()
elif choice == 2:
user_id = login_user()
if user_id is not None:
# You can add more functionality for logged-in users here
pass
elif choice == 3:
add_customer_details()
elif choice == 4:
profession = input('Enter the profession to search: ')
search_matches_by_profession(profession)
elif choice == 5:
appearance = input('Enter the appearance to search: ')
search_matches_by_appearance(appearance)
elif choice == 6:
print('Exiting the program')
12
break
else:
print('Invalid choice')
if __name__ == '__main__':
create_tables()
main_menu()
13
Sample Output:
***************MARRIAGE BUREAU MANAGEMENT****************
1. Register
2. Login
3. Add Customer Details
4. Search Matches by Profession
5. Search Matches by Appearance
6. Exit
Enter your choice: 1
Enter your Username: John
Enter your Password (only numbers): 12345
User created successfully
***************MARRIAGE BUREAU MANAGEMENT****************
1. Register
2. Login
3. Add Customer Details
4. Search Matches by Profession
5. Search Matches by Appearance
6. Exit
Enter your choice: 2
Enter your Username: John
Enter your Password: 12345
14
Login successful
***************MARRIAGE BUREAU MANAGEMENT****************
1. Register
2. Login
3. Add Customer Details
4. Search Matches by Profession
5. Search Matches by Appearance
6. Exit
Enter your choice: 3
Enter the name: Alice
Enter the address: 123 Main St
Enter the caste: XYZ
Enter the appearance: Beautiful
Enter the age: 28
Enter the profession: Engineer
Enter the phone number: 1234567890
Customer details added successfully
***************MARRIAGE BUREAU MANAGEMENT****************
1. Register
2. Login
3. Add Customer Details
4. Search Matches by Profession
5. Search Matches by Appearance
6. Exit
Enter your choice: 4
Enter the profession to search: Engineer
15
Matching customers:
(2, 'Alice', '123 Main St', 'XYZ', 'Beautiful', 28, 'Engineer', 1234567890)
*********************MARRIAGE BUREAU MANAGEMENT*****************
1. Register
2. Login
3. Add Customer Details
4. Search Matches by Profession
5. Search Matches by Appearance
6. Exit
Enter your choice: 5
Enter the appearance to search: Beautiful
Matching customers:
(2, 'Alice', '123 Main St', 'XYZ', 'Beautiful', 28, 'Engineer', 1234567890)
*******************MARRIAGE BUREAU MANAGEMENT********************
1. Register
2. Login
3. Add Customer Details
4. Search Matches by Profession
5. Search Matches by Appearance
6. Exit
Enter your choice: 6
Exiting the program
16