orbit-database


Nameorbit-database JSON
Version 1.0.5 PyPI version JSON
download
home_pagehttps://gitlab.com/madpenguin/orbit-database
SummaryDatabase library for Python based on LMDB storage engine
upload_time2023-07-07 15:17:38
maintainer
docs_urlNone
authorGareth Bult
requires_python>=3.10
license
keywords database nosql lmdb
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Orbit Database - Introduction

#### Welcome to the Orbit Database repository and documentation. All project documentation is included within this repository and consists of markdown files and comments within the code. These are presented in real time by the "ZeroDocs" Orbit application which renders this content to HTML in real-time.

This project is the NoSQL database that underpins the Orbit Framework. The interface is written in Python3 and uses LMDB as it's back-end key/value store. Please don't be put off by the <i>written in Python</i> statement, the database performs well and in many cases surpasses what you might expect from a dedicated database engine such as MariaDB or Postgres. The software architecture looks like this;

<table><tr><td><img style="height:350px" src="https://gitlab.com/madpenguin/orbit-database/-/raw/main/images/orbit_database.png" /></td><td>
<h3 style="padding-left:1.4em">Primary design goals</h3>

* Must perform well in a Python multi-processing environment
* Must integrate well with Python based microservices
* Must be easy to deploy in a cloud environment
* Must be easily testable in a Python environment
* Must offer the same basic functionality as mainstream database engines
* Must facilitate efficient real-time triggers when data is changed
* Must be easy to replicate in real time
</td></tr></table>

Although these goals are entirely subjective, when compared to Python applications using traditional SQL databases, in general these goals have arguably been surpassed. If you are looking for a fast primary database to use in a native non-Python environment, then look elsewhere. If you need a database system with more capacity for use outside of Python, then consider Orbit-Database as a cache / real-time buffer between your 'real' database and each user's screen. If all you need is a read-speed of a few hundred thousand records a second, and an ACID write speed of 20,000 per second, look no further!

### Database Features

* Schemaless / NoSQL model, but with dynamic ORM system
* Database interface effectively reads and writes Python objects
* Secondary indexes can be created using any Python expression / function
* Secondary indexes support primary and duplicate variants
* The storage engine supports ACID Transactions
* Locking system enables massively parallel writing over many processes
* Super lightweight, pip installable Python3 library with no persistent server

This database has been around since 2017 and had gone through a number of incarnations to arrive at this point. It started life as a quick and dirty solution to a long running problem and has morphed into a relatively polished solution which is now the cornerstone of Orbit Communicator and the Orbit Framework.

### What does it look like?

As a basic example, if we wanted to have a database with a table called people, and within that table store records of individuals, we might have something like the following. We would start by setting up an ORM model for the table which consists of two classes. The first is uses to represent an individual, or a single records within the table, the second to represent a collection of individuals, or a collection of records.

```python
from orbit_orm import BaseTable, BaseCollection

class PeopleTable (BaseTable):
    norm_table_name = 'people'

class PeopleCollection (BaseCollection):
    table_class = PeopleTable
```

Once we have this, we can open up a database and start work on some data. When we open the database we need to tell it which ORM models we'll be using (PeopleCollection in this case) and the name of the database. At a basic level a PeopleCollection() object resolves to an iterator for the contents of the table. Iterators always yield a <i>result</i> object, which in turn contains a <i>doc</i> object, which is your record. (or Person in this instance)

```python
from orbit_database import OrbitDatabase
from schema.People import PeopleCollection

OrbitDatabase([PeopleCollection]).open('my_database')
for result in PeopleCollection():
    person = result.doc
    print(f'Name={person._name} Age={person._age}')
```

## Todo List (features)

* Deploy new indexing on OC + test - running - wip
* Write V2 conversion routine - wip

* Implement rename table in shell
* Implement rename index in shell


* Freelist management and compression for full-text indexcies
* Resting encryption for specific fields and raw blobs and words
* Better form of JSON for reading fields without deserialisation
            

Raw data

            {
    "_id": null,
    "home_page": "https://gitlab.com/madpenguin/orbit-database",
    "name": "orbit-database",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "",
    "keywords": "database,nosql,lmdb",
    "author": "Gareth Bult",
    "author_email": "gareth@madpenguin.uk",
    "download_url": "https://files.pythonhosted.org/packages/2f/2b/bf4d2bb2c4defa08c69d06fb6977ff63981a12cad329a79bff7d381cd9ad/orbit_database-1.0.5.tar.gz",
    "platform": null,
    "description": "# Orbit Database - Introduction\n\n#### Welcome to the Orbit Database repository and documentation. All project documentation is included within this repository and consists of markdown files and comments within the code. These are presented in real time by the \"ZeroDocs\" Orbit application which renders this content to HTML in real-time.\n\nThis project is the NoSQL database that underpins the Orbit Framework. The interface is written in Python3 and uses LMDB as it's back-end key/value store. Please don't be put off by the <i>written in Python</i> statement, the database performs well and in many cases surpasses what you might expect from a dedicated database engine such as MariaDB or Postgres. The software architecture looks like this;\n\n<table><tr><td><img style=\"height:350px\" src=\"https://gitlab.com/madpenguin/orbit-database/-/raw/main/images/orbit_database.png\" /></td><td>\n<h3 style=\"padding-left:1.4em\">Primary design goals</h3>\n\n* Must perform well in a Python multi-processing environment\n* Must integrate well with Python based microservices\n* Must be easy to deploy in a cloud environment\n* Must be easily testable in a Python environment\n* Must offer the same basic functionality as mainstream database engines\n* Must facilitate efficient real-time triggers when data is changed\n* Must be easy to replicate in real time\n</td></tr></table>\n\nAlthough these goals are entirely subjective, when compared to Python applications using traditional SQL databases, in general these goals have arguably been surpassed. If you are looking for a fast primary database to use in a native non-Python environment, then look elsewhere. If you need a database system with more capacity for use outside of Python, then consider Orbit-Database as a cache / real-time buffer between your 'real' database and each user's screen. If all you need is a read-speed of a few hundred thousand records a second, and an ACID write speed of 20,000 per second, look no further!\n\n### Database Features\n\n* Schemaless / NoSQL model, but with dynamic ORM system\n* Database interface effectively reads and writes Python objects\n* Secondary indexes can be created using any Python expression / function\n* Secondary indexes support primary and duplicate variants\n* The storage engine supports ACID Transactions\n* Locking system enables massively parallel writing over many processes\n* Super lightweight, pip installable Python3 library with no persistent server\n\nThis database has been around since 2017 and had gone through a number of incarnations to arrive at this point. It started life as a quick and dirty solution to a long running problem and has morphed into a relatively polished solution which is now the cornerstone of Orbit Communicator and the Orbit Framework.\n\n### What does it look like?\n\nAs a basic example, if we wanted to have a database with a table called people, and within that table store records of individuals, we might have something like the following. We would start by setting up an ORM model for the table which consists of two classes. The first is uses to represent an individual, or a single records within the table, the second to represent a collection of individuals, or a collection of records.\n\n```python\nfrom orbit_orm import BaseTable, BaseCollection\n\nclass PeopleTable (BaseTable):\n    norm_table_name = 'people'\n\nclass PeopleCollection (BaseCollection):\n    table_class = PeopleTable\n```\n\nOnce we have this, we can open up a database and start work on some data. When we open the database we need to tell it which ORM models we'll be using (PeopleCollection in this case) and the name of the database. At a basic level a PeopleCollection() object resolves to an iterator for the contents of the table. Iterators always yield a <i>result</i> object, which in turn contains a <i>doc</i> object, which is your record. (or Person in this instance)\n\n```python\nfrom orbit_database import OrbitDatabase\nfrom schema.People import PeopleCollection\n\nOrbitDatabase([PeopleCollection]).open('my_database')\nfor result in PeopleCollection():\n    person = result.doc\n    print(f'Name={person._name} Age={person._age}')\n```\n\n## Todo List (features)\n\n* Deploy new indexing on OC + test - running - wip\n* Write V2 conversion routine - wip\n\n* Implement rename table in shell\n* Implement rename index in shell\n\n\n* Freelist management and compression for full-text indexcies\n* Resting encryption for specific fields and raw blobs and words\n* Better form of JSON for reading fields without deserialisation",
    "bugtrack_url": null,
    "license": "",
    "summary": "Database library for Python based on LMDB storage engine",
    "version": "1.0.5",
    "project_urls": {
        "Documentation": "https://gitlab.com/madpenguin/orbit-database",
        "Homepage": "https://gitlab.com/madpenguin/orbit-database",
        "Repository": "https://gitlab.com/madpenguin/orbit-database"
    },
    "split_keywords": [
        "database",
        "nosql",
        "lmdb"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e13b5f6241fe16bd6489a5c3b56ef263fcbbacc0d4ae6edc30ae8f5408ba28cd",
                "md5": "1dc47910b0d4020341308f59c10f0574",
                "sha256": "083e187ab6e17dbb1df08fa9201b3aa8d3467f4de41ebc992773947e7077f0b9"
            },
            "downloads": -1,
            "filename": "orbit_database-1.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1dc47910b0d4020341308f59c10f0574",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 50592,
            "upload_time": "2023-07-07T15:17:36",
            "upload_time_iso_8601": "2023-07-07T15:17:36.602150Z",
            "url": "https://files.pythonhosted.org/packages/e1/3b/5f6241fe16bd6489a5c3b56ef263fcbbacc0d4ae6edc30ae8f5408ba28cd/orbit_database-1.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2f2bbf4d2bb2c4defa08c69d06fb6977ff63981a12cad329a79bff7d381cd9ad",
                "md5": "31b4c22463dbed22d6ab0f781d05c2ce",
                "sha256": "9c5ab79f32a665bcfa1b7e4d6ef95c355a74af4721411364d927111018abe9f5"
            },
            "downloads": -1,
            "filename": "orbit_database-1.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "31b4c22463dbed22d6ab0f781d05c2ce",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 41199,
            "upload_time": "2023-07-07T15:17:38",
            "upload_time_iso_8601": "2023-07-07T15:17:38.356793Z",
            "url": "https://files.pythonhosted.org/packages/2f/2b/bf4d2bb2c4defa08c69d06fb6977ff63981a12cad329a79bff7d381cd9ad/orbit_database-1.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-07 15:17:38",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "madpenguin",
    "gitlab_project": "orbit-database",
    "lcname": "orbit-database"
}
        
Elapsed time: 0.09192s