Name | pydbconnect JSON |
Version |
1.0.0
JSON |
| download |
home_page | None |
Summary | A private database service library. |
upload_time | 2024-05-05 14:26:55 |
maintainer | None |
docs_url | None |
author | NexusNovelist |
requires_python | None |
license | None |
keywords |
python
database
server
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# PyDBConnect
this is simply an API implementation (wrapper) for my WebAPI [PyDBConnect](https://github.com/nexus-novelist/PyDBConnect)
## How to use
Clone the PyDBConnect server repo on your server and follow the instructions
Use the Pypi package to use the API implementation
## Installation
```
pip install PyDBConnect
```
## Documentation
Import the library
```python
>>> from pydbconnect import connection
```
Establish a connection to the PyDBConnect server
```python
>>> db = connection("localhost:7575", "project", "password")
```
Replace the hostname with your own hostname/ip (making sure to include the port).
replace "project" with your PyDBConnect project name, and the password with your pyDBConnect password.
Check server availability
```python
>>> db.ping_db().status_code
```
ping_db() method returns a Response object which you can get the status code out of.
if the status code returned is 200 then the server responded properly!
Get list of collections in project
```python
>>> db.get_collections()
```
Should return a list of strings representing collections in the project
Get collection data
```python
>>> db.get_collection("collection")
```
Should return the documents present in the collection
Get document contents
```python
>>> db.get_document("collection", "document_id")
```
Returns the contents of the document
Create document
```python
>>> db.create_document("collection", "document_id", {"key": "value", "key2": "value3"})
```
Creates a new document with the specified document_id in the collection
(Oh no! i messed up the value2. Let's fix that!)
Update document
```python
>>> db.update_document("collection", "document_id", {"key": "value", "key2": "value2"})
```
Updates the document with the specified document_id in the collection
Delete document
```python
>>> db.delete_document("collection", "document_id")
```
Note: This returns a Response object
Create new collection
```python
>>> db.create_collection("new_collection")
```
Creates a new collection with the given name
Delete a collection
```python
>>> db.delete_collection("new_collection")
```
Raw data
{
"_id": null,
"home_page": null,
"name": "pydbconnect",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "python, database, server",
"author": "NexusNovelist",
"author_email": "<proffesionalnoice@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/d4/73/a783edb48ec9f7197ed1e085adbb31caa041e553055a9542dc284057e820/pydbconnect-1.0.0.tar.gz",
"platform": null,
"description": "# PyDBConnect\r\nthis is simply an API implementation (wrapper) for my WebAPI [PyDBConnect](https://github.com/nexus-novelist/PyDBConnect)\r\n\r\n## How to use\r\nClone the PyDBConnect server repo on your server and follow the instructions\r\nUse the Pypi package to use the API implementation\r\n\r\n## Installation\r\n\r\n```\r\npip install PyDBConnect\r\n```\r\n\r\n## Documentation\r\n\r\nImport the library\r\n```python\r\n>>> from pydbconnect import connection\r\n```\r\n\r\nEstablish a connection to the PyDBConnect server\r\n```python\r\n>>> db = connection(\"localhost:7575\", \"project\", \"password\")\r\n```\r\nReplace the hostname with your own hostname/ip (making sure to include the port).\r\nreplace \"project\" with your PyDBConnect project name, and the password with your pyDBConnect password.\r\n\r\nCheck server availability\r\n```python\r\n>>> db.ping_db().status_code\r\n```\r\nping_db() method returns a Response object which you can get the status code out of.\r\nif the status code returned is 200 then the server responded properly!\r\n\r\nGet list of collections in project\r\n```python\r\n>>> db.get_collections()\r\n```\r\nShould return a list of strings representing collections in the project\r\n\r\nGet collection data\r\n```python\r\n>>> db.get_collection(\"collection\")\r\n```\r\nShould return the documents present in the collection\r\n\r\nGet document contents\r\n```python\r\n>>> db.get_document(\"collection\", \"document_id\")\r\n```\r\nReturns the contents of the document\r\n\r\nCreate document\r\n```python\r\n>>> db.create_document(\"collection\", \"document_id\", {\"key\": \"value\", \"key2\": \"value3\"})\r\n```\r\nCreates a new document with the specified document_id in the collection\r\n(Oh no! i messed up the value2. Let's fix that!)\r\n\r\nUpdate document\r\n```python\r\n>>> db.update_document(\"collection\", \"document_id\", {\"key\": \"value\", \"key2\": \"value2\"})\r\n```\r\nUpdates the document with the specified document_id in the collection\r\n\r\nDelete document\r\n```python\r\n>>> db.delete_document(\"collection\", \"document_id\")\r\n```\r\nNote: This returns a Response object\r\n\r\nCreate new collection\r\n```python\r\n>>> db.create_collection(\"new_collection\")\r\n```\r\nCreates a new collection with the given name\r\n\r\nDelete a collection\r\n```python\r\n>>> db.delete_collection(\"new_collection\")\r\n```\r\n\r\n\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A private database service library.",
"version": "1.0.0",
"project_urls": null,
"split_keywords": [
"python",
" database",
" server"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1e670aff0baf794941590f0c9ff55052b183ac22282602711f19c2f239fa5895",
"md5": "f2e773a9de9ae138627f2a74dd8acea5",
"sha256": "cf24e1768e211ccdae1613dc2166d086e9b6db3dbf5ef99fd1d548ea9b2438d6"
},
"downloads": -1,
"filename": "pydbconnect-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f2e773a9de9ae138627f2a74dd8acea5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 4224,
"upload_time": "2024-05-05T14:26:53",
"upload_time_iso_8601": "2024-05-05T14:26:53.768657Z",
"url": "https://files.pythonhosted.org/packages/1e/67/0aff0baf794941590f0c9ff55052b183ac22282602711f19c2f239fa5895/pydbconnect-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d473a783edb48ec9f7197ed1e085adbb31caa041e553055a9542dc284057e820",
"md5": "242def64d043d386c76e2605fcd21e3b",
"sha256": "b6d2e0b92c1e8b0cd3e19dfc854627ff639c15804f1f482b012e0abf55897cdd"
},
"downloads": -1,
"filename": "pydbconnect-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "242def64d043d386c76e2605fcd21e3b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 2851,
"upload_time": "2024-05-05T14:26:55",
"upload_time_iso_8601": "2024-05-05T14:26:55.507466Z",
"url": "https://files.pythonhosted.org/packages/d4/73/a783edb48ec9f7197ed1e085adbb31caa041e553055a9542dc284057e820/pydbconnect-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-05 14:26:55",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "pydbconnect"
}