Sitelet https://github.com/objectbox/objectbox-python/releases
Skip to content

Releases

ObjectBox Python 5.0: 3x faster than SQLite ORMs, now with Sync

Choose a tag to compare

@greenrobot greenrobot released this 19 Oct 12:11

ObjectBox Python 5.0 is the biggest update of the Python binding yet: it is much faster, syncs your data, has relations, unique constraints and a more complete query API, and installs smaller, platform-specific packages.

pip install objectbox        # or, to use ObjectBox Sync: pip install objectbox-sync

About 3x faster than the Python ORMs on SQLite

How does an embedded object database compare to SQLite accessed via the popular Python ORMs (SQLAlchemy, SQLModel,
Django, peewee, Tortoise ORM, ...)? We benchmarked it: in python-orm-benchmarks, ObjectBox has the best result in all three tests, about 3x the best SQL ORM (rows per second, geometric mean of 9 operations: get, queries, inserts, updates and deletes):

ObjectBox and SQLite ORMs: rows per second, higher is better

The benchmark runs everything in-process on local storage, times only the database work and reports the median of
5 runs; see the benchmark repository for the setup, result details and how to run it yourself.
It used the new, still experimental FlatBuffers codegen, which you enable with one line:

import objectbox.experimental
objectbox.experimental.enable_flatbuffers_codegen()  # generates the code to write and read objects per entity

Relations and more powerful queries

  • To-one relations: customer_id = Relation(Customer) stores the ID of the related object; ObjectBox knows the target, e.g. removing it resets the relation.
  • Link queries over relations, like in Java and Dart: link() and backlink(), across any number of relations.
  • New conditions and options: ordering (order(), OrderFlags), one_of()/not_one_of(), is_null(), datetime values in date conditions.
  • New query methods: find_first(), find_unique() and describe(); change values of a built query with set_parameter().
  • Vector search: nearest_neighbors(query_vector, max_result_count); scored results are named tuples (result.object, result.score).
  • Queries are freed: with box.query(...).build() as query: closes a query right away (the garbage collector and closing the store do too); before, every built query kept its native memory.

Data model and objects

  • Unique constraints: email = String(unique=Unique()), optionally replacing the conflicting object (ConflictStrategy.REPLACE).
  • Indexes: strings get a hash index by default, like in the other ObjectBox languages
    (Index(IndexType.VALUE) for e.g. starts_with()); indexes and other property flags can now be changed later.
  • Self-assigned IDs: Id(assignable=True). Without it, putting an object with an ID that ObjectBox did not assign now raises, which prevents data loss.
  • Boxes: put() of a list returns the IDs, new remove_many(), contains(), get_many() and update(); None values are stored as null.
  • Model file: removed entities and properties are recorded as retired UIDs, and fields of other ObjectBox languages are kept, so objectbox-model.json can be shared with them and the ObjectBox Generator.

Installation and platforms

  • Smaller downloads: the ObjectBox library comes in one wheel per platform (objectbox-clib) instead of one package with the libraries for all platforms; the Python code is in objectbox-api, and objectbox installs both.
  • New platforms: Windows ARM64, and 32-bit Python on a 64-bit Linux kernel (e.g. Raspberry Pi OS 32-bit).
  • Requirements: Python 3.7 or newer; ObjectBox library 5.3.2.
    Linux ARMv6 (e.g. Raspberry Pi Zero/1) is no longer supported, as PyPI has no wheels for it.

ObjectBox Sync for Python

Synchronize your data with an ObjectBox Sync Server, and through it with MongoDB: install objectbox-sync instead of objectbox, mark entities with @SyncEntity() and start a client:

from objectbox import Entity, Id, String, Store, Sync, SyncCredentials, SyncEntity

@SyncEntity()
@Entity()
class Task:
    id = Id
    text = String

store = Store()
client = Sync.client(store, "ws://127.0.0.1:9999", SyncCredentials.none())
client.start()  # syncs in the background, also when offline at first

Includes authentication (JWT), Sync filter variables, listeners for login, connection, completion and data changes, and SyncClock/SyncPrecedence properties for conflict resolution.

Property names are now stored in camelCase (date_created as dateCreated), like in the other ObjectBox languages, so Python apps share a data model with apps in Java, Kotlin, Dart or Swift.

⚠️ Breaking changes

Warning

Upgrading from 4.x with pip? Uninstall first: pip uninstall objectbox, then pip install objectbox.
An in-place pip install --upgrade objectbox breaks the installation
(repair it with pip install --force-reinstall --no-deps objectbox-api).
Fresh installs and upgrades with uv are not affected.

Most code keeps working; check these:

  • Property names are stored in camelCase; existing databases and model files are migrated automatically (see @Entity(python_names=True) to keep the Python names).
  • Putting an object with an ID that ObjectBox did not assign raises (use Id(assignable=True)).
  • String properties with Index() get a hash index (migrated when the store opens).
  • Exceptions: all derive from DbError (replacing CoreException and NotFoundException); wrong arguments raise TypeError or IllegalArgumentError.
  • Property classes take no id= argument (it was ignored); uid= is keyword-only.
  • The typed set_parameter_*() methods are replaced by set_parameter(); a query builder can not be reused after build().

See the CHANGELOG for all changes.

Learn more

Vector Search for Python: Objectbox 4.0.0

Choose a tag to compare

@greenrobot greenrobot released this 03 Jun 06:37
  • ObjectBox now supports vector search ("vector database") to enable efficient similarity searches.
    This is particularly useful for AI/ML/RAG applications, e.g. image, audio, or text similarity.
    Other use cases include sematic search or recommendation engines.
    See https://docs.objectbox.io/ann-vector-search for details.
  • The definition of entities (aka the data model) is now greatly simplified
    • Type-specific property classes, e.g. name: String, count: Int64, score: Float32
    • Automatic ID/UID and model management (i.e. add/remove/rename of entities and properties)
    • Automatic discovery of @entity classes
  • Queries: property-based conditions, e.g. box.query(City.name.starts_with("Be"))
  • Queries: logical operators, e.g. box.query(City.name == "Berlin" | City.name == "Munich")
  • Convenient "Store" API (deprecates ObjectBox and Builder API)
  • New examples added, illustrating an VectorSearch and AI/RAG application
  • Stable flat public API provided by single top-level module objectbox
  • Dependency flatbuffers: Updated to 24.3.50
  • Adjusting the version number to match the core version (4.0); we will be aligning on major versions from now on.

V4.0.0 Alpha Vector Search

Pre-release

Choose a tag to compare

@greenrobot greenrobot released this 16 May 08:56
  • ObjectBox now supports vector search ("vector database") to enable efficient similarity searches.
    This is particularly useful for AI/ML/RAG applications, e.g. image, audio, or text similarity.
    Other use cases include sematic search or recommendation engines.
    See https://docs.objectbox.io/ann-vector-search for details.
  • Queries: support for Property-based conditions and logic combinations
  • Convenient "Store" API deprecates ObjectBox and Builder API
  • New examples added, illustrating an VectorSearch and AI/RAG application
  • Dependency flatbuffers: Updated to 24.3.50
  • Adjusting the version number to match the core version (4.0); we will be aligning on major versions from now on.

v0.6.1 Support for in-memory database

Choose a tag to compare

@dan-obx dan-obx released this 19 Feb 16:23

The new version 0.6(.1) for the Python database comes with:

  • In-memory databases (by using directory path prefix "memory:")
  • numpy dependency fix
  • Update objectbox-c to v0.21.0 with many improvements (details)

v0.5.0 Vector and Date Types

Choose a tag to compare

@greenrobot greenrobot released this 13 Jun 13:01

The new version 0.5 for the Python database brings new types:

  • vector types allow efficient storage of numeric lists (and Numpy arrays), e.g. for vector embeddings in AI applications
  • Date types with millisecond and nanosecond precision

More info is available at: https://objectbox.io/vector-database-flutter/

v0.4.0

Choose a tag to compare

@greenrobot-team greenrobot-team released this 08 Dec 10:22
  • Scalar types support #11

v0.3.0

Choose a tag to compare

@vaind vaind released this 17 Aug 13:23
  • add support for Apple silicon (M1)
  • update to objectbox-c v0.14.0
  • update flatbuffers to v2.0.0

v0.2.0

Choose a tag to compare

@vaind vaind released this 09 Sep 11:09
  • update objectbox-c to v0.10.0
  • update flatbuffers to v1.12.0
  • add transactions support
  • add example
  • improve makefile
  • improve contribution guidelines