Skip to main content

Pydantic models working with deta.space api, including ORM features.

Project description

ormspace

ORM modules powered by Pydantic for Deta Space.


Instructions

The package ormspace will use the deta data key provides as COLLECTION_KEY or will look for DETA_PROJECT_KEY if the first is not provided. This way you can set a custom data key or use the project default. The sistem cannot work all is missing.

the 'modelmap' decorator

To include the class in the system mapping you must use the 'modelmap' decorator. With this procedure you will get:

  • access to deta space api for read and write your data
  • create special fields for each class:
    • Model.Key
    • Model.KeyList

Example

import datetime
import asyncio
from ormspace import model as md

@md.modelmap
class Person(md.Model):
    first_name: str 
    last_name: str 
    birth_date: datetime.date

@md.modelmap
class Patient(md.Model):
    person_key: Person.Key


async def main():
    await Patient.update_references_context()
    for item in await Patient.sorted_instances_list():
        print(item)

asyncio.run(main())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ormspace-0.3.1.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ormspace-0.3.1-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

Details for the file ormspace-0.3.1.tar.gz.

File metadata

  • Download URL: ormspace-0.3.1.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.18 Darwin/23.5.0

File hashes

Hashes for ormspace-0.3.1.tar.gz
Algorithm Hash digest
SHA256 6e18385998608635818db45212b6c37c7f83c064c22b607040ab26074b97a953
MD5 edc95f5b4338b267b19d8fc1b5c8064d
BLAKE2b-256 099ce76a5828657a4bcb200fadb449d939843accf626d9fdca34d73bba3dfbb3

See more details on using hashes here.

File details

Details for the file ormspace-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: ormspace-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 20.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.18 Darwin/23.5.0

File hashes

Hashes for ormspace-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8b26c4d2ca82ecfb019060bb8f455742b683510be9e98a22a16542c91b9a67b5
MD5 7d7f2e4d5500608b075dd428465003c5
BLAKE2b-256 38b2f09efd650ca16d2f76b608d0fc74fe85ed19bf645b87f28a8116d5593a2f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page