Name | dsqlenv JSON |
Version |
1.0.3
JSON |
| download |
home_page | https://gitee.com/iint/dsql |
Summary | A tool for database operations with encryption and decryption, configurable table and column names, and additional CLI features. |
upload_time | 2024-10-18 22:31:16 |
maintainer | None |
docs_url | None |
author | Zhao Sheng |
requires_python | >=3.10 |
license | None |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
<p align="center">
<img src="dsql.png" alt="DCheck Logo" width="150">
</p>
# dsqlenv-Env
[中文](README_zh.md) | English
`dsqlenv` is a SQL database operation tool designed to help developers quickly synchronize common variables, such as API keys, across different environments or hosts. All variables stored in the database are encrypted using AES for enhanced security.
## Table of Contents
- [Features](#features)
- [Installation](#installation)
- [Configuration](#configuration)
- [Quick Usage](#quick-usage)
- [Python Usage Examples](#python-usage-examples)
- [CLI Usage Examples](#cli-usage-examples)
- [License](#license)
## Features
- **Environment Variable Management**: Search and update environment variables using keywords or regular expressions.
- **Database Operations**: Perform basic SQL operations like get, insert, update, and delete records securely.
- **AES Encryption**: All variables stored in the database are encrypted to ensure sensitive information is protected.
## Installation
To install `dsqlenv`, follow these steps:
1. Clone the repository:
```bash
git clone https://gitee.com/iint/dsqlenv.git
cd dsqlenv
```
2. Install the required dependencies:
```bash
pip install -r requirements.txt
```
3. Create a `.env` file in the root directory and define the necessary environment variables, as explained in the next section.
or
```bash
pip install dsqlenv
```
## Configuration
Before using `dsqlenv`, ensure that your environment variables contain the following database information:
```bash
DB_USER='<username>' # Database username for authentication
DB_PASSWORD='<password>' # Password for the database user
DB_NAME='xxx' # The name of the database to connect to
DB_HOST='xxx' # Hostname or IP address of the database server
DB_PORT='xxx' # Port number for the database connection (default for MySQL is 3306)
AES_KEY='xxx' # AES encryption key for securing sensitive data
TABLE_NAME='dagent_info' # The name of the table to perform operations on
ID_COLUMN='name' # The column name that acts as the unique identifier for records
INFO_COLUMN='data' # The column name that stores the data you want to retrieve or update
```
Make sure to replace the placeholder values with your actual database credentials.
## Quick Usage
To get started with `dsqlenv`, you can use the command-line interface (CLI) for quick database and environment variable operations.
### Basic Commands
- **Get a Record**:
```bash
dsqlenv db --action get --id <Record ID>
```
- **Insert a Record**:
```bash
dsqlenv db --action insert --id <Record ID> --data <Record data>
```
- **Update a Record**:
```bash
dsqlenv db --action update --id <Record ID> --data <Record data>
```
- **Delete a Record**:
```bash
dsqlenv db --action delete --id <Record ID>
```
## Python Usage Examples
You can also use the `dsqlenv` library directly in your Python code.
```python
from dsqlenv.core import SQL
from dsqlenv.config import load_config
# Load configuration
config = load_config()
db = SQL(config)
# Insert a new record
db.insert_data("api_key", "your_api_key")
# Get a record by ID
data = db.get_data_by_id("api_key")
print(data)
# Update a record
db.update_data("api_key", "new_api_key")
# Delete a record
db.delete_data("api_key")
```
## CLI Usage Examples
Here are some examples of how to use the CLI effectively:
- **Search for Environment Variables**:
```bash
dsqlenv search-env --keyword SECRET
```
- **Update an Environment Variable**:
```bash
dsqlenv update-env --key API_KEY --value new_value
```
- **Search using Regular Expressions**:
```bash
dsqlenv re search '^SECRET'
```
- **Update using Regular Expressions**:
```bash
dsqlenv re update '^API_' 'new_value'
```
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": "https://gitee.com/iint/dsql",
"name": "dsqlenv",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": null,
"author": "Zhao Sheng",
"author_email": "zhaosheng@nuaa.edu.cn",
"download_url": "https://files.pythonhosted.org/packages/23/01/b08964d7d33fe56dea337b3b806089c731e0286fd1894646750e14ee2a1f/dsqlenv-1.0.3.tar.gz",
"platform": null,
"description": "<p align=\"center\">\n <img src=\"dsql.png\" alt=\"DCheck Logo\" width=\"150\">\n</p>\n\n# dsqlenv-Env\n\n[\u4e2d\u6587](README_zh.md) | English\n\n`dsqlenv` is a SQL database operation tool designed to help developers quickly synchronize common variables, such as API keys, across different environments or hosts. All variables stored in the database are encrypted using AES for enhanced security.\n\n## Table of Contents\n\n- [Features](#features)\n- [Installation](#installation)\n- [Configuration](#configuration)\n- [Quick Usage](#quick-usage)\n- [Python Usage Examples](#python-usage-examples)\n- [CLI Usage Examples](#cli-usage-examples)\n- [License](#license)\n\n## Features\n\n- **Environment Variable Management**: Search and update environment variables using keywords or regular expressions.\n- **Database Operations**: Perform basic SQL operations like get, insert, update, and delete records securely.\n- **AES Encryption**: All variables stored in the database are encrypted to ensure sensitive information is protected.\n\n## Installation\n\nTo install `dsqlenv`, follow these steps:\n\n1. Clone the repository:\n ```bash\n git clone https://gitee.com/iint/dsqlenv.git\n cd dsqlenv\n ```\n\n2. Install the required dependencies:\n ```bash\n pip install -r requirements.txt\n ```\n\n3. Create a `.env` file in the root directory and define the necessary environment variables, as explained in the next section.\n\nor \n\n```bash\npip install dsqlenv\n```\n\n## Configuration\n\nBefore using `dsqlenv`, ensure that your environment variables contain the following database information:\n\n```bash\nDB_USER='<username>' # Database username for authentication\nDB_PASSWORD='<password>' # Password for the database user\nDB_NAME='xxx' # The name of the database to connect to\nDB_HOST='xxx' # Hostname or IP address of the database server\nDB_PORT='xxx' # Port number for the database connection (default for MySQL is 3306)\nAES_KEY='xxx' # AES encryption key for securing sensitive data\nTABLE_NAME='dagent_info' # The name of the table to perform operations on\nID_COLUMN='name' # The column name that acts as the unique identifier for records\nINFO_COLUMN='data' # The column name that stores the data you want to retrieve or update\n```\n\nMake sure to replace the placeholder values with your actual database credentials.\n\n## Quick Usage\n\nTo get started with `dsqlenv`, you can use the command-line interface (CLI) for quick database and environment variable operations.\n\n### Basic Commands\n\n- **Get a Record**:\n ```bash\n dsqlenv db --action get --id <Record ID>\n ```\n\n- **Insert a Record**:\n ```bash\n dsqlenv db --action insert --id <Record ID> --data <Record data>\n ```\n\n- **Update a Record**:\n ```bash\n dsqlenv db --action update --id <Record ID> --data <Record data>\n ```\n\n- **Delete a Record**:\n ```bash\n dsqlenv db --action delete --id <Record ID>\n ```\n\n## Python Usage Examples\n\nYou can also use the `dsqlenv` library directly in your Python code.\n\n```python\nfrom dsqlenv.core import SQL\nfrom dsqlenv.config import load_config\n\n# Load configuration\nconfig = load_config()\ndb = SQL(config)\n\n# Insert a new record\ndb.insert_data(\"api_key\", \"your_api_key\")\n\n# Get a record by ID\ndata = db.get_data_by_id(\"api_key\")\nprint(data)\n\n# Update a record\ndb.update_data(\"api_key\", \"new_api_key\")\n\n# Delete a record\ndb.delete_data(\"api_key\")\n```\n\n## CLI Usage Examples\n\nHere are some examples of how to use the CLI effectively:\n\n- **Search for Environment Variables**:\n ```bash\n dsqlenv search-env --keyword SECRET\n ```\n\n- **Update an Environment Variable**:\n ```bash\n dsqlenv update-env --key API_KEY --value new_value\n ```\n\n- **Search using Regular Expressions**:\n ```bash\n dsqlenv re search '^SECRET'\n ```\n\n- **Update using Regular Expressions**:\n ```bash\n dsqlenv re update '^API_' 'new_value'\n ```\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n",
"bugtrack_url": null,
"license": null,
"summary": "A tool for database operations with encryption and decryption, configurable table and column names, and additional CLI features.",
"version": "1.0.3",
"project_urls": {
"Homepage": "https://gitee.com/iint/dsql"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "bd3d26c94706cf6cf9b2f2f031086f59765da534a9c45609538f0508fafdcf24",
"md5": "fb6b2719648a9f022408ddbf6a1da07e",
"sha256": "468126afb7ab928a946b291acb2808ef3b6df8ab8d90acafe93978d8f12cab61"
},
"downloads": -1,
"filename": "dsqlenv-1.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fb6b2719648a9f022408ddbf6a1da07e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 11451,
"upload_time": "2024-10-18T22:31:11",
"upload_time_iso_8601": "2024-10-18T22:31:11.105116Z",
"url": "https://files.pythonhosted.org/packages/bd/3d/26c94706cf6cf9b2f2f031086f59765da534a9c45609538f0508fafdcf24/dsqlenv-1.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2301b08964d7d33fe56dea337b3b806089c731e0286fd1894646750e14ee2a1f",
"md5": "23e97f568b0f3623adfd51e03291779e",
"sha256": "14ec592e77341e68b8fc01f251af32c3147f4785cc60d16b662ed5cdceeedbb1"
},
"downloads": -1,
"filename": "dsqlenv-1.0.3.tar.gz",
"has_sig": false,
"md5_digest": "23e97f568b0f3623adfd51e03291779e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 12868,
"upload_time": "2024-10-18T22:31:16",
"upload_time_iso_8601": "2024-10-18T22:31:16.200424Z",
"url": "https://files.pythonhosted.org/packages/23/01/b08964d7d33fe56dea337b3b806089c731e0286fd1894646750e14ee2a1f/dsqlenv-1.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-18 22:31:16",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "dsqlenv"
}