# Personal Interface
The Personal Interface is a Python project that provides a simple model for connecting to a database using the Deta library, among other utilities as loggers. It offers basic database operations such as querying, creating, updating, and deleting records. This README provides an overview of the project, installation instructions, and usage examples.
## Table of Contents
- [Personal Interface](#personal-interface)
- [Table of Contents](#table-of-contents)
- [Installation](#installation)
- [Usage](#usage)
- [DetaDatabase](#detadatabase)
- [Contributing](#contributing)
- [License](#license)
## Installation
Before you can use the Personal Interface, make sure you have Python installed on your system. You'll also need to set up a Deta project and obtain an API key. Follow these steps to get started:
1. Clone the repository:
```bash
pip install pyworkbench
```
2. Set your Deta project API key as an environment variable:
### Method 1
Using bash:
```bash
export DB_ACCESS_TOKEN=your_api_key
```
### Method 2
Using a `.env`
```env
DB_ACCESS_TOKEN = your_api_key
```
Replace `your_api_key` with your actual Deta API key.
3. Set your private API key to access and use the code:
### Method 1
Using bash:
```bash
export API_KEY=your_api_key
```
### Method 2
Using a `.env`
```env
API_KEY = your_api_key
```
Replace `your_api_key` with your actual Deta API key.
## Usage
This interface can only be used with a private `API_KEY`. Without it, the tool is not functional.
### DetaDatabase
The Personal Interface provides a simple way to interact with your Deta database. Here's how you can use it in your Python code:
1. Import the `DetaDatabase` class:
```python
from pyworkbench import DetaDatabase
```
2. Create an instance of the `DetaDatabase` class and connect to your Deta database:
```python
db = DetaDatabase()
db.connect("your_database_name")
```
Replace `"your_database_name"` with the name of your Deta database.
3. Perform database operations such as querying, creating, updating, and deleting records using the provided methods. For example:
```python
# Query for records
data = {"name": "John"}
results = db.query(data, filter_by="equal")
# Create a new record
new_data = {"name": "Alice", "age": 30}
key = db.create(new_data)
# Update an existing record
updated_data = {"key": key, "age": 31}
db.update(updated_data)
# Delete a record by its key
db.delete(key)
```
For more details on how to use the Personal Interface, refer to the [Python code documentation](https://github.com/ricardoleal20/deta_personal_interface/blob/main/deta_personal_interface/__main__.py) in the repository.
## Contributing
Contributions to this project are welcome! If you have suggestions, feature requests, or would like to report a bug, please open an issue on the [GitHub repository](https://github.com/ricardoleal20/deta_personal_interface). If you'd like to contribute code, please fork the repository, make your changes, and submit a pull request.
## License
This project is licensed under the MIT License - see the [LICENSE](https://github.com/ricardoleal20/deta_personal_interface/blob/main/LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": "https://github.com/ricardoleal20/personal_interface/",
"name": "pyworkbench",
"maintainer": "Ricardo Leal",
"docs_url": null,
"requires_python": "<4,>=3.8",
"maintainer_email": "ricardo.lealpz@gmail.com",
"keywords": "development, personal_usage",
"author": "Ricardo Leal",
"author_email": "ricardo.lealpz@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/87/87/9f3f794ea7e3b26ce9fc4da35b48e984ea65ad68e6d236f9565ffe73fe70/pyworkbench-0.5.0.tar.gz",
"platform": null,
"description": "# Personal Interface\n\nThe Personal Interface is a Python project that provides a simple model for connecting to a database using the Deta library, among other utilities as loggers. It offers basic database operations such as querying, creating, updating, and deleting records. This README provides an overview of the project, installation instructions, and usage examples.\n\n## Table of Contents\n\n- [Personal Interface](#personal-interface)\n - [Table of Contents](#table-of-contents)\n - [Installation](#installation)\n - [Usage](#usage)\n - [DetaDatabase](#detadatabase)\n - [Contributing](#contributing)\n - [License](#license)\n\n## Installation\n\nBefore you can use the Personal Interface, make sure you have Python installed on your system. You'll also need to set up a Deta project and obtain an API key. Follow these steps to get started:\n\n1. Clone the repository:\n\n ```bash\n pip install pyworkbench\n ```\n\n2. Set your Deta project API key as an environment variable:\n\n ### Method 1\n\n Using bash:\n ```bash\n export DB_ACCESS_TOKEN=your_api_key\n ```\n\n ### Method 2\n\n Using a `.env`\n ```env\n DB_ACCESS_TOKEN = your_api_key\n ```\n\n Replace `your_api_key` with your actual Deta API key.\n\n3. Set your private API key to access and use the code:\n\n ### Method 1\n\n Using bash:\n ```bash\n export API_KEY=your_api_key\n ```\n\n ### Method 2\n\n Using a `.env`\n ```env\n API_KEY = your_api_key\n ```\n\n Replace `your_api_key` with your actual Deta API key.\n\n## Usage\n\nThis interface can only be used with a private `API_KEY`. Without it, the tool is not functional.\n\n### DetaDatabase\n\nThe Personal Interface provides a simple way to interact with your Deta database. Here's how you can use it in your Python code:\n\n1. Import the `DetaDatabase` class:\n\n ```python\n from pyworkbench import DetaDatabase\n ```\n\n2. Create an instance of the `DetaDatabase` class and connect to your Deta database:\n\n ```python\n db = DetaDatabase()\n db.connect(\"your_database_name\")\n ```\n\n Replace `\"your_database_name\"` with the name of your Deta database.\n\n3. Perform database operations such as querying, creating, updating, and deleting records using the provided methods. For example:\n\n ```python\n # Query for records\n data = {\"name\": \"John\"}\n results = db.query(data, filter_by=\"equal\")\n\n # Create a new record\n new_data = {\"name\": \"Alice\", \"age\": 30}\n key = db.create(new_data)\n\n # Update an existing record\n updated_data = {\"key\": key, \"age\": 31}\n db.update(updated_data)\n\n # Delete a record by its key\n db.delete(key)\n ```\n\nFor more details on how to use the Personal Interface, refer to the [Python code documentation](https://github.com/ricardoleal20/deta_personal_interface/blob/main/deta_personal_interface/__main__.py) in the repository.\n\n## Contributing\n\nContributions to this project are welcome! If you have suggestions, feature requests, or would like to report a bug, please open an issue on the [GitHub repository](https://github.com/ricardoleal20/deta_personal_interface). If you'd like to contribute code, please fork the repository, make your changes, and submit a pull request.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](https://github.com/ricardoleal20/deta_personal_interface/blob/main/LICENSE) file for details.\n",
"bugtrack_url": null,
"license": null,
"summary": null,
"version": "0.5.0",
"project_urls": {
"Bug Reports": "https://github.com/ricardoleal20/personal_interface/issues",
"Homepage": "https://github.com/ricardoleal20/personal_interface/"
},
"split_keywords": [
"development",
" personal_usage"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9f7d21e79d5d23727d15c3c90bbb22294e39504f98bfb6a208dca09441315641",
"md5": "6f911bec18004038753cdbae13583e43",
"sha256": "00c8d09761d266ac67756b5b7f2f85d4a7e765bfc5f861270cadf8f906aaf1ef"
},
"downloads": -1,
"filename": "pyworkbench-0.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6f911bec18004038753cdbae13583e43",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4,>=3.8",
"size": 32465,
"upload_time": "2024-06-08T03:45:20",
"upload_time_iso_8601": "2024-06-08T03:45:20.066072Z",
"url": "https://files.pythonhosted.org/packages/9f/7d/21e79d5d23727d15c3c90bbb22294e39504f98bfb6a208dca09441315641/pyworkbench-0.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "87879f3f794ea7e3b26ce9fc4da35b48e984ea65ad68e6d236f9565ffe73fe70",
"md5": "b8d5fec67672fde71561f1eccbdbec74",
"sha256": "dfdec08ea37eafae27df39b95389bc950a6666b48fff1334676df87e6cb1b007"
},
"downloads": -1,
"filename": "pyworkbench-0.5.0.tar.gz",
"has_sig": false,
"md5_digest": "b8d5fec67672fde71561f1eccbdbec74",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4,>=3.8",
"size": 26906,
"upload_time": "2024-06-08T03:45:21",
"upload_time_iso_8601": "2024-06-08T03:45:21.739374Z",
"url": "https://files.pythonhosted.org/packages/87/87/9f3f794ea7e3b26ce9fc4da35b48e984ea65ad68e6d236f9565ffe73fe70/pyworkbench-0.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-08 03:45:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ricardoleal20",
"github_project": "personal_interface",
"github_not_found": true,
"lcname": "pyworkbench"
}