Package: orbit_database
Orbit Database - IntroductionWelcome 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 thewritten in Pythonstatement, 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 ...Primary design goalsMust perform well in a Python multi-processing environmentMust integrate well with Python based microservicesMust be easy to deploy in a cloud environmentMust be easily testable in a Python environmentMust offer the same basic functionality as mainstream database enginesMust facilitate efficient real-time triggers when data is changedMust be easy to replicate in real timeAlthough 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 FeaturesSchemaless / NoSQL model, but with dynamic ORM systemDatabase interface effectively reads and writes Python objectsSecondary indexes can be created using any Python expression / functionSecondary indexes support primary and duplicate variantsThe storage engine supports ACID TransactionsLocking system enables massively parallel writing over many processesSuper lightweight, pip installable Python3 library with no persistent serverThis 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.fromorbit_ormimportBaseTable,BaseCollectionclassPeopleTable(BaseTable):norm_table_name='people'classPeopleCollection(BaseCollection):table_class=PeopleTableOnce 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 aresultobject, which in turn contains adocobject, which is your record. (or Person in this instance)fromorbit_databaseimportOrbitDatabasefromschema.PeopleimportPeopleCollectionOrbitDatabase([PeopleCollection]).open('my_database')forresultinPeopleCollection():person=result.docprint(f'Name={person._name}Age={person._age}')Todo List (features)Deploy new indexing on OC + test - running - wipWrite V2 conversion routine - wipImplement rename table in shellImplement rename index in shellFreelist management and compression for full-text indexciesResting encryption for specific fields and raw blobs and wordsBetter form of JSON for reading fields without deserialisation