Skip to main content

SQLSimplify Python Library

The SQLSimplify Python library provides a comprehensive and flexible interface for interacting with MySQL databases. It simplifies common database operations such as querying, creating, updating, deleting, backing up, and restoring databases and tables.

Features

  • Fetch and manage databases and tables
  • Create and modify tables and columns
  • Insert, update, and delete rows in tables
  • Backup and restore databases and tables
  • Execute raw SQL queries

Installation

You can install the library using pip:

pip install SQLSimplify

Usage

Importing the Library

import SQLSimplify

Connecting to MySQL

To use the library, create an instance of the SQLSimplify. Connect class by providing the host, username, password, and optionally the database name.

db = SQLSimplify.Connect(host='localhost', username='root', password='yourpassword', database='yourdatabase') 
#database not required for initial connection

Get Class

Fetch Databases

db.get.database()

Fetch Tables in a Database

db.get.tables('yourdatabase')

Create Class

Create a New Table

db.create.table('new_table', 'id INT PRIMARY KEY, name VARCHAR(100), age INT')

Add a Column to a Table

db.create.column('existing_table', 'new_column', 'VARCHAR(255)')

Delete Class

Delete a Table

db.delete.table('table_to_delete')

Delete a Column from a Table

db.delete.column('table_name', 'column_to_delete')

Delete Rows from a Table

db.delete.row('table_name', 'condition')

Update Class

Update Rows in a Table

db.update.row('table_name', {'column1': 'new_value', 'column2': 10}, 'id = 1')

Modify a Column

db.update.column('table_name', 'column_name', 'VARCHAR(255)')

Rename a Table

db.update.table_name('old_table_name', 'new_table_name')

Backup Class

Backup a Database

db.backup.backup_database('/path/to/backup.sql')

Backup a Table

db.backup.backup_table('table_name', '/path/to/table_backup.sql')

Restore a Database

db.backup.restore_database('/path/to/backup.sql')

Restore a Table

db.backup.restore_table('table_name', '/path/to/table_backup.sql')

Query Class

Execute a Raw SQL Query

db.query.execute('SELECT * FROM table_name')

Perform a SELECT Query

results = db.query.select('table_name', 'column1, column2', 'column1 = value')
print(results)

Perform an INSERT Query

db.query.insert('table_name', {'column1': 'value1', 'column2': 'value2'})

Perform an UPDATE Query

db.query.update('table_name', {'column1': 'new_value'}, 'condition')

Perform a DELETE Query

db.query.delete('table_name', 'condition')

Create a Table

db.query.create_table('new_table', 'id INT PRIMARY KEY, name VARCHAR(100)')

Drop a Table

db.query.drop_table('table_name')

Truncate a Table

db.query.truncate_table('table_name')

Release files for SQLSimplify 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for SQLSimplify 0.1
File Size Uploaded
sqlsimplify-0.1.tar.gz 8.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for SQLSimplify 0.1
File Interpreter ABI Platform
SQLSimplify-0.1-py3-none-any.whl Python 3 none any Details

Total release size: 15.7 kB

Release files / sqlsimplify-0.1.tar.gz

Download URL sqlsimplify-0.1.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
fc0ca5fc68ac9ad445196ca8c78144d6b218eb77e7b0c68954bb2ac13da993be
BLAKE2b-256 checksum
How to use checksums
fbb0e0f9e19edfed7a417053d3aa7e43d1cfc29e39323fcca4e125ba3dc09ec5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.6

Release files / SQLSimplify-0.1-py3-none-any.whl

Download URL SQLSimplify-0.1-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee17e89882c6050d091553721908cd4f4358b3fc56fd0f0025bee4703e0a48f7
BLAKE2b-256 checksum
How to use checksums
66fd6709cce6eec77fd066aa4df62921bdf5132a23591e1dbde9e5ca550390af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.6

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page