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

  1. Install MariaDB server (if not already installed):

    sudo apt update
    sudo apt install mariadb-server
    
  2. Start MariaDB service:

    sudo systemctl start mariadb
    sudo systemctl enable mariadb
    
  3. Secure MariaDB installation:

    sudo mysql_secure_installation
    
  4. Create the database and user:

    sudo mysql -u root -p
    

    Then 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;
    
  5. Test the connection:

    mysql -u omron -p cantare_injectie
    

    Enter password: Initial01!

Installation

  1. Install Python 3.7+ if not already installed
  2. Install the required dependencies:
    pip install -r requirements.txt
    
    Or using virtual environment:
    python3 -m venv venv
    source venv/bin/activate
    pip install -r requirements.txt
    

Usage

  1. Make sure MariaDB server is running:

    sudo systemctl status mariadb
    
  2. Run the application:

    python main.py
    

    Or:

    chmod +x run_app.sh
    ./run_app.sh
    
  3. 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
  4. 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
  5. To delete a record:

    • Enter the ID to delete
    • Click "Delete"
    • Confirm the deletion in the popup
  6. 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 application
  • database_manager.py: MariaDB database operations class
  • requirements.txt: Python dependencies
  • test_database.py: Test script for database operations
  • run_app.sh: Startup script
  • README.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

  1. Connection Error 1698:

    • Make sure MariaDB is running: sudo systemctl start mariadb
    • Verify user exists and has correct password
    • Check database exists: SHOW DATABASES;
  2. Access Denied:

    • Verify user permissions: SHOW GRANTS FOR 'omron'@'localhost';
    • Reset password if needed: ALTER USER 'omron'@'localhost' IDENTIFIED BY 'Initial01!';
  3. Database/Table doesn't exist:

    • The application will create the table automatically
    • Make sure the database cantare_injectie exists

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
No description provided
Readme 85 KiB
Languages
Python 89.9%
Shell 7.3%
Batchfile 2.8%