Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Adarsh275/PetrolPump-Management-System/llms.txt

Use this file to discover all available pages before exploring further.

Owners are the individuals who hold financial stakes in one or more petrol pump stations. The system models a many-to-many relationship: a single pump can have multiple owners, and a single person can co-own multiple pumps. Each owner record stores personal contact information and their overall partnership percentage. The link between a specific owner and a specific pump is recorded separately in the Owns relationship table.

Field Reference

Owner_Name
string
required
Primary key. The full name of the owner, up to 20 characters. Because this is the primary key it must be unique across all owner records and cannot be changed during an update.Example: Pawan Kumar
Contact_NO
char(10)
required
The owner’s 10-digit contact number stored as a fixed-length character string.Example: 9431073500
DOB
date
The owner’s date of birth. Entered via a Streamlit date picker and stored in YYYY-MM-DD format.Example: 1971-01-03
Gender
char
A single character indicating the owner’s gender. Accepted values are M (male) or F (female).
Address
string
The owner’s postal address, up to 255 characters.Example: Friends colony more, Patna, Bihar
Partnership
integer
required
The owner’s percentage share in the petrol pump, stored as a whole-number integer (e.g. 35 represents 35%).

Add an Owner

1

Open the Owners table

In the left sidebar, click the Tables dropdown and select Owners.
2

Select the Add operation

In the CRUD Operations dropdown, select Add.The main area will display the subheader “Enter Owners Details:”.
3

Fill in the form fields

Complete the six input fields presented in the form:
FieldInput typeRequired
Owner_NameText
Contact_NOText
DOBDate picker
GenderText (M or F)
AddressText
PartnershipNumber
4

Submit the record

Click Add Owners Details. A green success banner confirms the new record:
Successfully added Owners details: Pawan Kumar
The UI function that renders this form is create_for_Owners() in create.py:
def create_for_Owners():
    with st.container():
        Owner_Name   = st.text_input("Owner_Name:")
        Contact_NO   = st.text_input("Contact_NO:")
        DOB          = st.date_input("DOB:")
        Gender       = st.text_input("Gender:")
        Address      = st.text_input("Enter Address")
        Partnership  = st.number_input("Your Partership")

    if st.button("Add Owners Details"):
        add_Owners_data(Owner_Name, Contact_NO, DOB, Gender, Address, Partnership)
        st.success("Successfully added Owners details: {}".format(Owner_Name))
The INSERT statement executed by add_Owners_data() in database.py:
def add_Owners_data(Owner_Name, Contact_NO, DOB, Gender, Address, Partnership):
    c.execute(
        'INSERT INTO Owners '
        '(Owner_Name, Contact_NO, DOB, Gender, Address, Partnership) '
        'VALUES (%s,%s,%s,%s,%s,%s)',
        (Owner_Name, Contact_NO, DOB, Gender, Address, Partnership)
    )
    mydb.commit()

View Owners

1

Open the Owners table

In the sidebar Tables dropdown, select Owners.
2

Select View

In the CRUD Operations dropdown, select View.
3

Expand the table

Click the “View all Owners” expander to see the full owners list rendered as a Pandas DataFrame with columns: Owner_Name, Contact_NO, DOB, Gender, Address, Partnership.
def read_for_Owners():
    result = view_all_Owners_data()
    df = pd.DataFrame(
        result,
        columns=['Owner_Name', 'Contact_NO', 'DOB', 'Gender', 'Address', 'Partnership']
    )
    with st.expander("View all Owners"):
        st.dataframe(df)

Update an Owner

1

Open the Owners table

In the sidebar Tables dropdown, select Owners.
2

Select Update

In the CRUD Operations dropdown, select Update.A “Current Owners details” expander shows the existing data, and an “Owners to Edit” selectbox lists every Owner_Name in the database.
3

Choose the owner to edit

Select the target owner’s name from the dropdown. Their current field values are automatically pre-filled into the form inputs.
4

Edit the fields

Modify any of the five editable fields: Contact_NO, DOB, Gender, Address, or Partnership.
Owner_Name is the primary key and cannot be changed through this form. Only the five non-key fields listed above are editable. If you need to correct an owner’s name, delete the record and re-create it.
5

Save changes

Click Update Owners. A success message confirms the update, and the “Updated data” expander refreshes below.
The SQL executed by edit_Owners_data() in database.py:
UPDATE Owners
SET Contact_NO=%s,
    DOB=%s,
    Gender=%s,
    Address=%s,
    Partnership=%s
WHERE Owner_Name=%s

Delete an Owner

Deleting an owner removes their personal record from the Owners table. If the owner is currently linked to one or more pumps through the Owns relationship table, those join-table rows reference Owner_Name as a foreign key. Ensure all associations in the Owns table are removed before deleting an owner record to avoid constraint errors.
1

Open the Owners table

In the sidebar Tables dropdown, select Owners.
2

Select Remove

In the CRUD Operations dropdown, select Remove.
3

Choose the owner to delete

Select the owner’s name from the “Owners to delete” selectbox. An inline warning is displayed:
Do you want to delete :: Pawan Kumar
4

Confirm deletion

Click Delete Owners. On success the message “Owners has been deleted successfully” is shown and the table refreshes in the “Updated data” expander.
The SQL executed by delete_data_Owners() in database.py:
def delete_data_Owners(selected_Owners):
    c.execute('DELETE FROM Owners WHERE Owner_Name="{}"'.format(selected_Owners))
    mydb.commit()

Seed Data

The following five owner records are inserted by create_table.sql:
INSERT INTO `Owners`
  (`Owner_Name`, `Contact_NO`, `DOB`, `Gender`, `Address`, `Partnership`)
VALUES
  ('Pawan Kumar',        '9431073500', '1971-01-03', 'M', 'Friends colony more,Patna,Bihar',               35),
  ('Avinash Shankar',    '8783249500', '1973-07-15', 'M', 'Buddha colony,Patna,Bihar',                     25),
  ('Vikash Kumar Tarun', '7486249500', '1975-02-05', 'M', 'Tapeshwer Path,Boring road,Patna,Bihar',        45),
  ('Nirmal Sethi',       '6427894500', '1999-09-11', 'F', 'Pritam Nagar, Paldi, Ahmedabad, Gujarat',       70),
  ('Neerja Bhanot',      '5963154800', '2000-02-24', 'F', 'Quarters, Sarojini Nagar,New Delhi',            55);

Linking an owner to a specific petrol pump is handled through the Owns relationship table, which records (Registration_No, Owner_Name) pairs. The Streamlit UI does not expose direct CRUD operations for the Owns table — pump-owner associations must be managed directly in the database (e.g. via the Query tab or a MySQL client). See the seed data in create_table.sql for example Owns rows.

Build docs developers (and LLMs) love