Skip to main content

A private database service library.

Project description

PyDBConnect

this is simply an API implementation (wrapper) for my WebAPI 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

>>> from pydbconnect import connection

Establish a connection to the PyDBConnect server

>>> 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

>>> 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

>>> db.get_collections()

Should return a list of strings representing collections in the project

Get collection data

>>> db.get_collection("collection")

Should return the documents present in the collection

Get document contents

>>> db.get_document("collection", "document_id")

Returns the contents of the document

Create document

>>> 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

>>> db.update_document("collection", "document_id", {"key": "value", "key2": "value2"})

Updates the document with the specified document_id in the collection

Delete document

>>> db.delete_document("collection", "document_id")

Note: This returns a Response object

Create new collection

>>> db.create_collection("new_collection")

Creates a new collection with the given name

Delete a collection

>>> db.delete_collection("new_collection")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydbconnect-1.0.0.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydbconnect-1.0.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file pydbconnect-1.0.0.tar.gz.

File metadata

  • Download URL: pydbconnect-1.0.0.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.0

File hashes

Hashes for pydbconnect-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b6d2e0b92c1e8b0cd3e19dfc854627ff639c15804f1f482b012e0abf55897cdd
MD5 242def64d043d386c76e2605fcd21e3b
BLAKE2b-256 d473a783edb48ec9f7197ed1e085adbb31caa041e553055a9542dc284057e820

See more details on using hashes here.

File details

Details for the file pydbconnect-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pydbconnect-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.0

File hashes

Hashes for pydbconnect-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cf24e1768e211ccdae1613dc2166d086e9b6db3dbf5ef99fd1d548ea9b2438d6
MD5 f2e773a9de9ae138627f2a74dd8acea5
BLAKE2b-256 1e670aff0baf794941590f0c9ff55052b183ac22282602711f19c2f239fa5895

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page