# 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:
```bash
pip install SQLSimplify
```
## Usage
Importing the Library
```python
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.
```Python
db = SQLSimplify.Connect(host='localhost', username='root', password='yourpassword', database='yourdatabase')
#database not required for initial connection
```
## Get Class
Fetch Databases
```Python
db.get.database()
```
## Fetch Tables in a Database
```Python
db.get.tables('yourdatabase')
```
## Create Class
### Create a New Table
```Python
db.create.table('new_table', 'id INT PRIMARY KEY, name VARCHAR(100), age INT')
```
### Add a Column to a Table
```Python
db.create.column('existing_table', 'new_column', 'VARCHAR(255)')
```
## Delete Class
### Delete a Table
```Python
db.delete.table('table_to_delete')
```
### Delete a Column from a Table
```Python
db.delete.column('table_name', 'column_to_delete')
```
### Delete Rows from a Table
```Python
db.delete.row('table_name', 'condition')
```
## Update Class
### Update Rows in a Table
```Python
db.update.row('table_name', {'column1': 'new_value', 'column2': 10}, 'id = 1')
```
### Modify a Column
```Python
db.update.column('table_name', 'column_name', 'VARCHAR(255)')
```
### Rename a Table
```Python
db.update.table_name('old_table_name', 'new_table_name')
```
## Backup Class
### Backup a Database
```Python
db.backup.backup_database('/path/to/backup.sql')
```
### Backup a Table
```Python
db.backup.backup_table('table_name', '/path/to/table_backup.sql')
```
### Restore a Database
```Python
db.backup.restore_database('/path/to/backup.sql')
```
### Restore a Table
```Python
db.backup.restore_table('table_name', '/path/to/table_backup.sql')
```
## Query Class
### Execute a Raw SQL Query
```Python
db.query.execute('SELECT * FROM table_name')
```
### Perform a SELECT Query
```Python
results = db.query.select('table_name', 'column1, column2', 'column1 = value')
print(results)
```
### Perform an INSERT Query
```Python
db.query.insert('table_name', {'column1': 'value1', 'column2': 'value2'})
```
### Perform an UPDATE Query
```Python
db.query.update('table_name', {'column1': 'new_value'}, 'condition')
```
### Perform a DELETE Query
```Python
db.query.delete('table_name', 'condition')
```
### Create a Table
```Python
db.query.create_table('new_table', 'id INT PRIMARY KEY, name VARCHAR(100)')
```
### Drop a Table
```Python
db.query.drop_table('table_name')
```
### Truncate a Table
```Python
db.query.truncate_table('table_name')
```
Raw data
{
"_id": null,
"home_page": null,
"name": "SQLSimplify",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "pysql, sqlite, python sql, quicksql, sql, mysql, SQLSimplify",
"author": null,
"author_email": "Ankush Kumar <ankush1611996@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/fb/b0/e0f9e19edfed7a417053d3aa7e43d1cfc29e39323fcca4e125ba3dc09ec5/sqlsimplify-0.1.tar.gz",
"platform": null,
"description": "# SQLSimplify Python Library\n\nThe 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.\n\n## Features\n\n- Fetch and manage databases and tables\n- Create and modify tables and columns\n- Insert, update, and delete rows in tables\n- Backup and restore databases and tables\n- Execute raw SQL queries\n\n## Installation\n\nYou can install the library using pip:\n\n```bash\npip install SQLSimplify\n```\n\n## Usage\nImporting the Library\n```python\nimport SQLSimplify\n```\n\n## Connecting to MySQL\nTo use the library, create an instance of the SQLSimplify.\nConnect class by providing the host, username, password, and optionally the database name.\n\n```Python\ndb = SQLSimplify.Connect(host='localhost', username='root', password='yourpassword', database='yourdatabase') \n#database not required for initial connection\n```\n\n## Get Class\nFetch Databases\n\n```Python\ndb.get.database()\n```\n\n## Fetch Tables in a Database\n```Python\ndb.get.tables('yourdatabase')\n```\n## Create Class\n### Create a New Table\n\n```Python\ndb.create.table('new_table', 'id INT PRIMARY KEY, name VARCHAR(100), age INT')\n```\n### Add a Column to a Table\n\n```Python\ndb.create.column('existing_table', 'new_column', 'VARCHAR(255)')\n```\n## Delete Class\n### Delete a Table\n\n```Python\ndb.delete.table('table_to_delete')\n```\n### Delete a Column from a Table\n\n```Python\ndb.delete.column('table_name', 'column_to_delete')\n```\n### Delete Rows from a Table\n\n```Python\ndb.delete.row('table_name', 'condition')\n```\n## Update Class\n### Update Rows in a Table\n\n```Python\ndb.update.row('table_name', {'column1': 'new_value', 'column2': 10}, 'id = 1')\n```\n### Modify a Column\n\n```Python\ndb.update.column('table_name', 'column_name', 'VARCHAR(255)')\n```\n### Rename a Table\n\n```Python\ndb.update.table_name('old_table_name', 'new_table_name')\n```\n## Backup Class\n### Backup a Database\n\n```Python\ndb.backup.backup_database('/path/to/backup.sql')\n```\n### Backup a Table\n\n```Python\ndb.backup.backup_table('table_name', '/path/to/table_backup.sql')\n```\n### Restore a Database\n\n```Python\ndb.backup.restore_database('/path/to/backup.sql')\n```\n### Restore a Table\n\n```Python\ndb.backup.restore_table('table_name', '/path/to/table_backup.sql')\n```\n## Query Class\n### Execute a Raw SQL Query\n\n```Python\ndb.query.execute('SELECT * FROM table_name')\n```\n### Perform a SELECT Query\n\n```Python\nresults = db.query.select('table_name', 'column1, column2', 'column1 = value')\nprint(results)\n```\n### Perform an INSERT Query\n\n```Python\ndb.query.insert('table_name', {'column1': 'value1', 'column2': 'value2'})\n```\n### Perform an UPDATE Query\n\n```Python\ndb.query.update('table_name', {'column1': 'new_value'}, 'condition')\n```\n### Perform a DELETE Query\n\n```Python\ndb.query.delete('table_name', 'condition')\n```\n### Create a Table\n\n```Python\ndb.query.create_table('new_table', 'id INT PRIMARY KEY, name VARCHAR(100)')\n```\n### Drop a Table\n\n```Python\ndb.query.drop_table('table_name')\n```\n### Truncate a Table\n\n```Python\ndb.query.truncate_table('table_name')\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python library for easy SQl operations",
"version": "0.1",
"project_urls": {
"Bug Tracker": "https://github.com/AnkushRozra/quicksql/issues",
"Homepage": "https://github.com/AnkushRozra/quicksql"
},
"split_keywords": [
"pysql",
" sqlite",
" python sql",
" quicksql",
" sql",
" mysql",
" sqlsimplify"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "66fd6709cce6eec77fd066aa4df62921bdf5132a23591e1dbde9e5ca550390af",
"md5": "52d7978dce8befca36eab67b57841872",
"sha256": "ee17e89882c6050d091553721908cd4f4358b3fc56fd0f0025bee4703e0a48f7"
},
"downloads": -1,
"filename": "SQLSimplify-0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "52d7978dce8befca36eab67b57841872",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 7196,
"upload_time": "2024-09-12T09:05:22",
"upload_time_iso_8601": "2024-09-12T09:05:22.610369Z",
"url": "https://files.pythonhosted.org/packages/66/fd/6709cce6eec77fd066aa4df62921bdf5132a23591e1dbde9e5ca550390af/SQLSimplify-0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "fbb0e0f9e19edfed7a417053d3aa7e43d1cfc29e39323fcca4e125ba3dc09ec5",
"md5": "309fb2c0448e14cd49ab040af89531ba",
"sha256": "fc0ca5fc68ac9ad445196ca8c78144d6b218eb77e7b0c68954bb2ac13da993be"
},
"downloads": -1,
"filename": "sqlsimplify-0.1.tar.gz",
"has_sig": false,
"md5_digest": "309fb2c0448e14cd49ab040af89531ba",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 8521,
"upload_time": "2024-09-12T09:05:23",
"upload_time_iso_8601": "2024-09-12T09:05:23.931837Z",
"url": "https://files.pythonhosted.org/packages/fb/b0/e0f9e19edfed7a417053d3aa7e43d1cfc29e39323fcca4e125ba3dc09ec5/sqlsimplify-0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-12 09:05:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "AnkushRozra",
"github_project": "quicksql",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "sqlsimplify"
}