11ObjectBox Python API
22====================
3+
34ObjectBox is a superfast database for objects, now also available for Python with a simple CRUD API.
45
56* Python version: 3.4+
6- * Platforms supported:
7- * Linux 64-bit
8- * Linux ARMv6hf (e.g. Raspberry PI Zero)
9- * Linux ARMv7hf (e.g. Raspberry PI 3)
10- * MacOS 64-bit
11- * Windows 64-bit
7+ * Platforms supported:
8+ * Linux x86-64 (64-bit)
9+ * Linux ARMv6hf (e.g. Raspberry PI Zero)
10+ * Linux ARMv7hf (e.g. Raspberry PI 3)
11+ * MacOS x86-64 (64-bit)
12+ * MacOS arm64 (Apple silicon)
13+ * Windows x86-64 (64-bit)
1214
1315Getting started
1416---------------
17+
1518First of all, install the latest version:
19+
1620``` bash
1721pip install --upgrade objectbox
1822```
1923
20- To start using ObjectBox as a storage for your data, you need to define your model first.
21- The model consists of Python classes annotated with ` @Entity ` decorator.
24+ To start using ObjectBox as a storage for your data, you need to define your model first.
25+ The model consists of Python classes annotated with ` @Entity ` decorator.
2226
2327### Model IDs and UIDs
24- Each Entity has to have an ID (unique among entities).
25- Properties need an ID as well (unique inside one Entity).
28+
29+ Each Entity has to have an ID (unique among entities).
30+ Properties need an ID as well (unique inside one Entity).
2631Both Entities and Properties must also have an UID, which is a globally unique identifier.
2732
2833For other ObjectBox supported languages, the binding takes care of assigning these IDs/UIDs but this feature is not yet implemented for Python.
29- To learn more, see ObjectBox Java documentation: https://docs.objectbox.io/advanced/meta-model-ids-and-uids
34+ To learn more, see [ ObjectBox Java documentation] ( https://docs.objectbox.io/advanced/meta-model-ids-and-uids )
3035
3136#### model.py
37+
3238``` python
3339from objectbox.model import *
3440
@@ -40,10 +46,12 @@ class Person:
4046```
4147
4248### Using ObjectBox
49+
4350To actually use the database, you launch (or "build") it with the model you've just defined.
4451Afterwards, you can reuse the instance (` ob ` in the example below) and use it to access "Entity Boxes" which hold your objects.
45-
52+
4653#### program.py
54+
4755``` python
4856import objectbox
4957# from mypackage.model import Person
@@ -56,7 +64,7 @@ ob = objectbox.Builder().model(model).directory("db").build()
5664
5765# Open the box of "Person" entity. This can be called many times but you can also pass the variable around
5866box = objectbox.Box(ob, Person)
59-
67+
6068id = box.put(Person(first_name = " Joe" , last_name = " Green" )) # Create
6169person = box.get(id ) # Read
6270person.last_name = " Black"
@@ -75,11 +83,13 @@ For more information and code examples, see the tests folder. The docs for other
7583
7684Some features
7785-------------
86+
7887* automatic transactions (ACID compliant)
7988* bulk operations
8089
8190Coming in the future
8291--------------------
92+
8393The goodness you know from the other ObjectBox language-bindings, e.g.,
8494
8595* model management (no need to manually set id/uid)
@@ -91,29 +101,33 @@ The goodness you know from the other ObjectBox language-bindings, e.g.,
91101
92102Help wanted
93103-----------
94- ObjectBox for Python is still in an early stage with limited feature set (compared to other languages).
95- To bring all these features to Python, we're asking the community to help out. PRs are more than welcome!
96- The ObjectBox team will try its best to guide you and answer questions.
104+
105+ ObjectBox for Python is still in an early stage with limited feature set (compared to other languages).
106+ To bring all these features to Python, we're asking the community to help out. PRs are more than welcome!
107+ The ObjectBox team will try its best to guide you and answer questions.
97108See [ CONTRIBUTING.md] ( https://github.com/objectbox/objectbox-python/blob/main/CONTRIBUTING.md ) to get started.
98109
99110Feedback
100111--------
101- Also, please let us know your feedback by opening an issue: for example, if you experience errors or if you have ideas
112+
113+ Also, please let us know your feedback by opening an issue: for example, if you experience errors or if you have ideas
102114for how to improve the API. Thanks!
103115
104116License
105117-------
106- Copyright 2019-2020 ObjectBox Ltd. All rights reserved.
107-
108- Licensed under the Apache License, Version 2.0 (the "License");
109- you may not use this file except in compliance with the License.
110- You may obtain a copy of the License at
111-
112- http://www.apache.org/licenses/LICENSE-2.0
113-
114- Unless required by applicable law or agreed to in writing, software
115- distributed under the License is distributed on an "AS IS" BASIS,
116- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
117- See the License for the specific language governing permissions and
118- limitations under the License.
119118
119+ ``` text
120+ Copyright 2019-2021 ObjectBox Ltd. All rights reserved.
121+
122+ Licensed under the Apache License, Version 2.0 (the "License");
123+ you may not use this file except in compliance with the License.
124+ You may obtain a copy of the License at
125+
126+ http://www.apache.org/licenses/LICENSE-2.0
127+
128+ Unless required by applicable law or agreed to in writing, software
129+ distributed under the License is distributed on an "AS IS" BASIS,
130+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
131+ See the License for the specific language governing permissions and
132+ limitations under the License.
133+ ```
0 commit comments