Skip to main content

Database system implementing encrypted versions JSON of data. Easy to access, manage and deploy remotely

Project description

logo

bearDB

Database system implementing AES encrypted versions JSON of data. Easy to access, manage and deploy remotely

Web Documentation

Database Architecture

Project
 -Database
   -Bucket
      -Data

Outline

Install Libraries

$ python3 -m pip install bearDB

Import Libraries

from beardb import Beardb
from beardb import Bucket

Initialize Project

project = Beardb('projectname')
project.load_database('class') 

Initialize Bucket(DataBase File)

users = Bucket(project=project, bucket_name='users') # Project variable defined in the initialization 

Insert Data into Bucket

data = {
       'name':'Teddy Oweh',
       'Random Data':'Golf'
}
users.insert(data=data)
 

Fetch Data From ID

userinfo = users.fetchbyID(id="ae0ca44e-5301-11ed-8d24-a6bd5a94b3a6")

Fetch Data From Query

query= {
       'name':'Teddy Oweh',
       'Random Data':'Golf'
}
userinfo = users.fetchData(query=query)

Updata Data in Bucket From Query

query= {
       'name':'Teddy Oweh',
       'Random Data':'Golf'
}
newdata = {
       'name':'Teddy Oweh',
       'Random Data':'Ping Pong',
       'Added Data':'College'
       
}

users.update(query=query,data=newdata)

Update Data From Bucket From ID

  
newdata = {
       'name':'Teddy Oweh',
       'Random Data':'Ping Pong',
       'Added Data':'College'
       
}

users.updatebyId(id='ae0ca44e-5301-11ed-8d24-a6bd5a94b3a6',data=newdata})

Delete Data From Bucket From Query

query= {
       'name':'Teddy Oweh',
       'Random Data':'Golf'
}
 

users.delete(query=query})
 

Delete Data From Bucket From ID

users.deletebyId(id="ae0ca44e-5301-11ed-8d24-a6bd5a94b3a6")


### Test Code
```py
beardb_ = Beardb('projects')
beardb_.load_database('computers')
computers=Bucket(beardb_,'computers')
computers.insert({'model':'lenovo','ram':'8gb','hdd':'1tb','processor':'i5'})

Working with BeardbAPI

In Order to communicate with the microservice beardbAPI deploys when launched. This client Library consumes APIs effienctly and returns the data and status code.

Outline

Importing Library

from beardb import Client

Initialize Client Object

Whenever a new user is created, is always returns the secret to be able to access the data.

host='127.0.0.1'
port=5555
email='teddyoweh@gmail.com'
secret='3687065edf2fdc64bbeb8cdac409ac352fdb65f01423159842d19283309cb70c'
client = Client(
                host=host,
                port=port,
                email=email,
                secret=secret
              )           

Get User Data

cient.mydata()

Create New User

email='teddyoweh@gmail.com'
password='myrealpassword'
fullname='Teddy Oweh'

client.createnewuser(
                     fullname=fullname
                     email=email
                     password=password
)

Create New Project

project='TestProject'
client.createnewproject(
                       project=project
)

Create New Database

project='TestProject'
database='TestDatabase'
client.createnewdatabase(
                         project=project,
                         database=database
)   

Create New Bucket

project='TestProject'
database='TestDatabase'
bucket='TestBucket'
client.createnewbucket(
                         project=project,
                         database=database,
                         bucket=bucket
)   

Insert Data

project='TestProject'
database='TestDatabase'
bucket='TestBucket'
data={'name':'teddy',age:1}
client.insertdata(
                         project=project,
                         database=database,
                         bucket=bucket
)   

Fetch Data by Query

project='TestProject'
database='TestDatabase'
bucket='TestBucket'
query={'name':'teddy',age:1}
client.fetchdata(
                         project=project,
                         database=database,
                         bucket=bucket,
                         query=query
)   

Fetch Data by ID

project='TestProject'
database='TestDatabase'
bucket='TestBucket'
id='b419840a-7e04-11ed-84f8-324d38bf6d75'
client.fetchBYID(
                         project=project,
                         database=database,
                         bucket=bucket,
                         id=id
)   

Update Data by Query

project='TestProject'
database='TestDatabase'
bucket='TestBucket'
data={'name':'teddy',age:1}
query='{name':'teddy'}
client.updatedata(
                         project=project,
                         database=database,
                         bucket=bucket,
                         data=data,
                         query=query
)   

Update Data by ID

project='TestProject'
database='TestDatabase'
bucket='TestBucket'
data={'name':'teddy',age:1}
id='b419840a-7e04-11ed-84f8-324d38bf6d75'
client.updatebyid(
                         project=project,
                         database=database,
                         bucket=bucket,
                         data=data,
                         id=id
)   

Delete Data by Query

project='TestProject'
database='TestDatabase'
bucket='TestBucket'
query={'name':'teddy',age:1}
client.deletedata(
                         project=project,
                         database=database,
                         bucket=bucket,
                         query=query
)   

Delete Data by ID

project='TestProject'
database='TestDatabase'
bucket='TestBucket'
id='b419840a-7e04-11ed-84f8-324d38bf6d75'
client.deletebyid(
                         project=project,
                         database=database,
                         bucket=bucket,
                         id=id
)   

Get Buckets

client.getbuckets()

Get Databases

client.getdatabases()

Get Projects

cient.getprojects()

License

MIT License

Copyright (c) 2022 Teddy Oweh

teddyoweh built it di

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

beardb-0.0.5.tar.gz (9.4 kB view details)

Uploaded Source

File details

Details for the file beardb-0.0.5.tar.gz.

File metadata

  • Download URL: beardb-0.0.5.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for beardb-0.0.5.tar.gz
Algorithm Hash digest
SHA256 1bab9e0e3c1037eb7cada44dc7e52d64306242eaf3a92d988da53a95ddfcd826
MD5 941bbc0caca9d862a43cf9fe8533611b
BLAKE2b-256 b9749ab6a1fa77b3cd7749aa30b88653bfba8cc9d4f4e9efb08b6e5576932ea6

See more details on using hashes here.

Supported by

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