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
- Host: GitHub
- URL: https://github.com/carlossilva2/pybase
- Owner: carlossilva2
- License: mit
- Created: 2019-11-17T12:48:47.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-11-17T16:51:33.000Z (over 6 years ago)
- Last Synced: 2025-03-20T06:29:07.081Z (over 1 year ago)
- Topics: data, database, json, python3, storage
- Language: Python
- Homepage:
- Size: 11.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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**
* [Record](#rec-class)(database=None)
* **addOrQuery**(self, field: str, operator, condition) -> object
* **addQuery**(self, field: str, operator, condition) -> object
`Filter data by field and by providing a value`
`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
---
* [pyBase](#py-class)(record=None, database=None, index=None)
`Permanently deletes Record from database`
`Returns date of Record creation`
`Permanently saves Record changes in Database`
`Returns last update date`
---
`Returns pyBase local path`
* **getDBInfo**(db: str) -> None
`Get DB structure`
`Get databases in local system`
---
* **create_database_from_schema**(verbose=False)
* **create_new_database**(name, verbose=True)
`Method to create new database`
* **encrypt**(*args, **kwargs)
`Method to encrypt data`
`Loads data from a DB`
1. @param db - Name of Database
1. @returns JSON dict
`Save json data`