A modern, Pythonic ORM for TypeDB with an Attribute-based API
Project description
TypeBridge
A modern, Pythonic ORM for TypeDB with an Attribute-based API that aligns with TypeDB's type system.
Features
- True TypeDB Semantics: Attributes are independent types that entities and relations own
- Type-Safe: Full Python type hints and IDE autocomplete support
- Declarative Models: Define entities and relations using Python classes
- Automatic Schema Generation: Generate TypeQL schemas from your Python models
- CRUD Operations: Simple managers for entity and relation operations
- Query Builder: Pythonic interface for building TypeQL queries
- Clean API: No Pydantic conflicts, simple dict-based value storage
Installation
# Clone the repository
git clone https://github.com/yourusername/type_bridge.git
cd type_bridge
# Install with uv
uv sync
# Or with pip
pip install -e .
Quick Start
1. Define Attribute Types
from type_bridge import String, Long, Key
class Name(String):
pass
class Age(Long):
pass
NameKey = Key(Name) # Mark as key attribute
2. Define Entities
from type_bridge import Entity
class Person(Entity):
__type_name__ = "person"
name: NameKey # Person owns 'name' as @key
age: Age # Person owns 'age'
3. Work with Data
from type_bridge import Database, SchemaManager, EntityManager
# Setup
db = Database(address="localhost:1729", database="mydb")
schema_manager = SchemaManager(db)
schema_manager.register(Person)
schema_manager.sync_schema(force=True)
# CRUD
person_manager = EntityManager(db, Person)
alice = person_manager.create(name="Alice", age=30)
all_people = person_manager.all()
Documentation
See ATTRIBUTE_API.md for complete documentation.
Running Examples
uv run python examples/basic_usage.py
Running Tests
uv run pytest tests/ -v
Requirements
- Python 3.13+
- TypeDB 2.x or 3.x
- typedb-driver==3.5.5
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
type_bridge-0.1.0.tar.gz
(30.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file type_bridge-0.1.0.tar.gz.
File metadata
- Download URL: type_bridge-0.1.0.tar.gz
- Upload date:
- Size: 30.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4b8b05984420f686cf01a7b573c5dee08369bb5247896fabe4cb1f34fc7562e
|
|
| MD5 |
562ce349a1d878290919f53a4c50b805
|
|
| BLAKE2b-256 |
1c10c4b55d797692c84cec6735ac8c0e38a477c2113470ba09868b80ea084a34
|
File details
Details for the file type_bridge-0.1.0-py3-none-any.whl.
File metadata
- Download URL: type_bridge-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
905a9dc3f835c4ebd893183d222841e3ae464fba8a0385f8ad424b317536a64b
|
|
| MD5 |
ac1fe8ed50a2869d59b942bde5a34d87
|
|
| BLAKE2b-256 |
b62238c8381956daea82b8820bb0f0d543cbf53d1f64594882ce87eda7ae55ee
|