sqlitewrap is a Python library for user authentication and database management using SQLite. It provides a class-based API to securely manage users, create databases and tables, and perform CRUD operations, all with error handling and password hashing.
- User registration and authentication (with SHA-256 password hashing)
- Create, select, and remove databases
- Create, update, and remove tables
- Insert and fetch table data
- Change user passwords
- Connect and compare tables
- Custom error classes for robust exception handling
Clone the repository and install dependencies (if any):
git clone https://github.com/yasshrai/sqlitewrap.git
Import the connect class from sqlitewrap.py and use its methods for user and database management:
from sqlitewrap import connect
# Register a new user
c = connect()
c.CreateUsernamePassword('username', 'password')
# Authenticate user
c = connect('username', 'password')
# Create a new database
c.CreateDatabase('mydb')
# Select a database
c.UseDatabase('mydb')
# Create a table
c.CreateTable('mytable')
# Insert data into table
c.InsertIntoTable('mytable', ['value1', 'value2'])
# Fetch data from table
for row in c.FetchTable('mytable'):
print(row)
# Change password
c.ChangePassword('username', 'oldpassword', 'newpassword')All operations raise custom exceptions for error handling (see sqlitewrap.py).
sqlitewrap.py: Main library with theconnectclass and helper functionspyproject.toml: Project metadataREADME.md: Project documentation
Pull requests and issues are welcome!