A handy-dandy datastore built on top of Pydantic
Project description
Pydandy
Pydandtic + Handy
A lightweight "Database", built on top of Pydandtic. It is currently under development, but the intent is to support in-memory, file, and directory storage options and eventually an Async variant. For the file and directory modes, the data will be backed by either one or manyu JSON files. The main database is also meant to provide a slim ORM-like interface for querying the data.
Examples
from pydantic import BaseModel
from pydandy import PydandyDB
# Create an in-memory database
db = PydandyDB()
# Add User Model to the database
@db.register()
class User(BaseModel):
id: int
first_name: str
last_name: str
# You can use any model, as long you provide a __hash__
def __hash__(self):
return self.id
# Add a new Record to Users
db.User.add(
User(
id=1,
first_name="John",
last_name="Baz",
)
)
# Get your record back
user = db.User.get(1)
# Filter for records
db.User.filter(lambda record: record.first_name.startswith("J"))
Motivation
Mostly just because, but also because I occasionaly finding myself wanting a small data, portable data store. This seemed like fun project idea, and I really Pydandtic, so it worked out.
Contributing
At this stage, I am not accepting contributions. Mostly because I am still trying to shape out the core functionality. However, this should change soon™ if you are interested in helping out.
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
Built Distribution
File details
Details for the file pydandy-0.0.1.tar.gz
.
File metadata
- Download URL: pydandy-0.0.1.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.14 CPython/3.10.5 Darwin/21.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 401ebc71da3952b546bdcd43b4fdfb73c6af20789951b83b68694772d98a336e |
|
MD5 | be0a1cfad31ddafebda4725d3dd31a4b |
|
BLAKE2b-256 | 84bfed634497e6e3a1790b81a7d0a27511e12cc18eb28df0d82a365338d87db4 |
File details
Details for the file pydandy-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: pydandy-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.14 CPython/3.10.5 Darwin/21.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2de92a0995e2caef6ef3d1bc104238b9b97e3ddab31c7fc7a72cd7fadbf310e4 |
|
MD5 | 0a2a06cb3bf6d5e722938d419df41224 |
|
BLAKE2b-256 | a44297a37b405bd239f43e443d9c3893b97dcd09f2454a05ef797fa80fa58b2d |