An ORM-like Single Table Application (STA) architecture library for Python and DynamoDb. Makes it really eason to set up and work with STAs.
The library is in alpha. Constant work is being done on it as I’m developing my game.
Requirements
Pydantic 2.3+
Python 3.8+
Probably works on older versions of Python, but we haven’t tested it.
Installation
pip install statikk
Basic Usage
from statikk.models import DatabaseModel, Table, GlobalSecondaryIndex, KeySchema
class MyAwesomeModel(DatabaseModel):
player_id: str
tier: str
name: str = "Foo"
values: set = {1, 2, 3, 4}
cost: int = 4
@classmethod
def index_definitions(cls) -> dict[str, IndexFieldConfig]:
return {"main-index": IndexFieldConfig(pk_fields=["player_id"], sk_fields=["tier"])}
table = Table(
name="my-dynamodb-table",
key_schema=KeySchema(hash_key="id"),
indexes=[
GSI(
name="main-index",
hash_key=Key(name="gsi_pk"),
sort_key=Key(name="gsi_sk"),
)
],
models=[MyAwesomeModel],
)
def main():
my_model = MyAwesomeModel(id="foo", player_id="123", tier="gold")
my_model.save()
MyAwesomeModel.update("foo").set(name="Bar").delete("values", {1}).add("cost", 1).execute() # Update multiple fields at once
my_model = table.get("foo", MyAwesomeModel) # Get a model by its primary key using the table
my_model = MyAwesomeModel.get("foo") # Get a model by its primary key using the model's class
my_model.gsi_pk # returns "123"
my_model.gsi_sk # returns "MyAwesomeModel|gold"
my_model.delete() # Delete a model
Features
Easy model definition using Pydantic
Automatic index value construction based on marked fields.
Get, Update, Delete, Batch Get, Batch Write, Query, and Scan operations
Metadata
Release files for statikk 0.1.28
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| statikk-0.1.28.tar.gz | 67.9 kB | Without provenance | Details for statikk-0.1.28.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| statikk-0.1.28-py3-none-any.whl | Python 3 | none | any | Details for statikk-0.1.28-py3-none-any.whl |
Total release size: 88.1 kB
Release files / statikk-0.1.28.tar.gz
| Download URL | statikk-0.1.28.tar.gz |
|---|---|
| Size | 67.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0be323cce61578cd010ea46c9487a33d81575a97bbac5610b28417b7b097814b
|
|
BLAKE2b-256 checksum How to use checksums |
d620f6ee8507f7add1c4820ff0b8ba369b0405634d2630ac97f8c6cc35247559
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.0
|
Release files / statikk-0.1.28-py3-none-any.whl
| Download URL | statikk-0.1.28-py3-none-any.whl |
|---|---|
| Size | 20.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
952ce509e573bf5db159bd9ea2082f2a581a35c365a399aae58a2c394bdb9725
|
|
BLAKE2b-256 checksum How to use checksums |
0deb9156bd1d53c55fb5034c5105e78d372a963a664493a7649c6132365938f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.0
|
Security for statikk 0.1.28
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.