An open API service indexing awesome lists of open source software.

https://github.com/carlossilva2/pybase

An easy to use Database using Python and JSON
https://github.com/carlossilva2/pybase

data database json python3 storage

Last synced: about 1 month ago
JSON representation

An easy to use Database using Python and JSON

Awesome Lists containing this project

README

          

# Index:

1. [Classes](#gen-class)
1. [Record](#rec-class)
* [Methods](#rec-meth)
1. [addOrQuery](#Record-addOrQuery)
1. [addQuery](#Record-addQuery)
1. [delete](#Record-delete)
1. [get](#Record-get)
1. [insert](#Record-insert)
1. [mark_delete](#Record-mark_delete)
1. [query](#Record-query)
1. [setLimit](#Record-setLimit)
1. [sort_by](#Record-sort_by)

2. [pyBase](#py-class)
* [Methods](#py-meth)
1. [delete](#pyBase-delete)
1. [getCreationTime](#pyBase-getCreationTime)
1. [update](#pyBase-update)
1. [updateTime](#pyBase-updateTime)

* [Static Methods](#py-static)
1. [getConfigPath](#pyBase-getConfigPath)
1. [getDBInfo](#pyBase-getDBInfo)
1. [getDatabases](#pyBase-getDatabases)

3. [Functions](#gen-func)
1. [create_database_from_schema](#-create_database_from_schema)
1. [create_new_database](#-create_new_database)
1. [encrypt](#-encrypt)
1. [load_data](#-load_data)
1. [save](#-save)

# **pyBase**


## **Classes**


### class **Record**()

* [Record](#rec-class)(database=None)


#### Methods defined here:


* **addOrQuery**(self, field: str, operator, condition) -> object


* **addQuery**(self, field: str, operator, condition) -> object

`Filter data by field and by providing a value`


* **delete**(self) -> None

`DEPRECATED METHOD`


* **get**(self, id: str, p=False) -> [pyBase](#py-class)

`Returns a single database entry`

1. @param id - Unique record ID

1. @param p - Flag for formated print

1. @returns [pyBase](#py-class) Object


* **insert**(self, json_data: dict) -> str

`Inserts [Record](#Record) in Database`

1. @param json_data - dict


* **mark_delete**(self, data: dict) -> object

`DEPRECATED METHOD`


* **query**(self, p=False) -> None

`Returns the results of a database with/without filter options and stores in "result" variable`

1. @param p - Flag for formated print

1. @returns None


* **setLimit**(self, limit: int) -> None

`Set the number of Records returned`
1. @param limit - Number of records


* **sort_by**(self, field: str, order: str) -> object

`Set the order of the list`

1. @param field - Field of a Database

1. @param order - If order is Ascending or Descending

---


### class **pyBase**

* [pyBase](#py-class)(record=None, database=None, index=None)


#### Methods defined here:


* **delete**(self) -> None

`Permanently deletes Record from database`


* **getCreationTime**(self)

`Returns date of Record creation`


* **update**(self) -> None

`Permanently saves Record changes in Database`


* **updateTime**(self)

`Returns last update date`

---


Static methods defined here:


* **getConfigPath**()

`Returns pyBase local path`


* **getDBInfo**(db: str) -> None

`Get DB structure`


* **getDatabases**() -> list

`Get databases in local system`
---


### **Functions**


* **create_database_from_schema**(verbose=False)


* **create_new_database**(name, verbose=True)

`Method to create new database`


* **encrypt**(*args, **kwargs)

`Method to encrypt data`


* **load_data**(db)

`Loads data from a DB`
1. @param db - Name of Database
1. @returns JSON dict


* **save**(data, where)

`Save json data`