Database Manager Kivy App
A simple Kivy application for managing a MariaDB database with two columns (id and mass) for the offsystemsCounting table.
Features
- Search: Look up records by ID
- Add/Update: Add new records or update existing ones
- Delete: Remove records from the database
- View All: Display all records in the database
- Auto-create: Table is created automatically if it doesn't exist
Prerequisites
MariaDB Server Setup
-
Install MariaDB server (if not already installed):
sudo apt update sudo apt install mariadb-server -
Start MariaDB service:
sudo systemctl start mariadb sudo systemctl enable mariadb -
Secure MariaDB installation:
sudo mysql_secure_installation -
Create the database and user:
sudo mysql -u root -pThen run these SQL commands:
CREATE DATABASE cantare_injectie; CREATE USER 'omron'@'localhost' IDENTIFIED BY 'Initial01!'; GRANT ALL PRIVILEGES ON cantare_injectie.* TO 'omron'@'localhost'; FLUSH PRIVILEGES; EXIT; -
Test the connection:
mysql -u omron -p cantare_injectieEnter password:
Initial01!
Installation
- Install Python 3.7+ if not already installed
- Install the required dependencies:
Or using virtual environment:
pip install -r requirements.txtpython3 -m venv venv source venv/bin/activate pip install -r requirements.txt
Usage
-
Make sure MariaDB server is running:
sudo systemctl status mariadb -
Run the application:
python main.pyOr:
chmod +x run_app.sh ./run_app.sh -
To search for a record:
- Enter an ID in the "ID" field (max 20 characters)
- Click "Search"
- If found, the mass will be displayed in the "Mass" field
-
To add or update a record:
- Enter both ID and mass value
- Click "Add/Update"
- If the ID exists, it will be updated; otherwise, a new record will be created
-
To delete a record:
- Enter the ID to delete
- Click "Delete"
- Confirm the deletion in the popup
-
To refresh the display:
- Click "Refresh All" to reload all data from the database
Database Structure
The app connects to MariaDB database cantare_injectie with the following table structure:
CREATE TABLE offsystemsCounting (
id VARCHAR(20) PRIMARY KEY,
mass REAL NOT NULL
)
Files
main.py: Main Kivy applicationdatabase_manager.py: MariaDB database operations classrequirements.txt: Python dependenciestest_database.py: Test script for database operationsrun_app.sh: Startup scriptREADME.md: This documentation
Connection Settings
The application connects to MariaDB with these settings:
- Host: localhost
- Database: cantare_injectie
- User: omron
- Password: Initial01!
- Table: offsystemsCounting
Troubleshooting
-
Connection Error 1698:
- Make sure MariaDB is running:
sudo systemctl start mariadb - Verify user exists and has correct password
- Check database exists:
SHOW DATABASES;
- Make sure MariaDB is running:
-
Access Denied:
- Verify user permissions:
SHOW GRANTS FOR 'omron'@'localhost'; - Reset password if needed:
ALTER USER 'omron'@'localhost' IDENTIFIED BY 'Initial01!';
- Verify user permissions:
-
Database/Table doesn't exist:
- The application will create the table automatically
- Make sure the database
cantare_injectieexists
Notes
- IDs must be unique and max 20 characters
- Mass values must be valid decimal numbers
- The app includes comprehensive error handling and user feedback
- All database operations use parameterized queries for security
Description
Languages
Python
89.9%
Shell
7.3%
Batchfile
2.8%