ormspace


Nameormspace JSON
Version 0.3.1 PyPI version JSON
download
home_pageNone
SummaryPydantic models working with deta.space api, including ORM features.
upload_time2024-05-26 23:59:37
maintainerNone
docs_urlNone
authorDaniel Arantes
requires_python<4.0,>=3.9
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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())


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ormspace",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Daniel Arantes",
    "author_email": "arantesdv@me.com",
    "download_url": "https://files.pythonhosted.org/packages/09/9c/e76a5828657a4bcb200fadb449d939843accf626d9fdca34d73bba3dfbb3/ormspace-0.3.1.tar.gz",
    "platform": null,
    "description": "# ormspace \nORM modules powered by Pydantic for Deta Space.\n\n--- \n\n### Instructions\n\nThe package **ormspace**  will use the deta data key provides as _COLLECTION_KEY_ or will look for _DETA_PROJECT_KEY_ if the \nfirst is not provided. This way you can set a custom data key or use the project default. The sistem cannot work all is\nmissing. \n\n#### the 'modelmap' decorator \nTo include the class in the system mapping you must use the 'modelmap' decorator.  With this procedure you will get:\n- access to deta space api for read and write your data \n- create special fields for each class:\n  - Model.Key \n  - Model.KeyList\n  \n\n### Example\n    import datetime\n    import asyncio\n    from ormspace import model as md\n\n    @md.modelmap\n    class Person(md.Model):\n        first_name: str \n        last_name: str \n        birth_date: datetime.date\n\n    @md.modelmap\n    class Patient(md.Model):\n        person_key: Person.Key\n\n\n    async def main():\n        await Patient.update_references_context()\n        for item in await Patient.sorted_instances_list():\n            print(item)\n\n    asyncio.run(main())\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Pydantic models working with deta.space api, including ORM features.",
    "version": "0.3.1",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "38b2f09efd650ca16d2f76b608d0fc74fe85ed19bf645b87f28a8116d5593a2f",
                "md5": "7d7f2e4d5500608b075dd428465003c5",
                "sha256": "8b26c4d2ca82ecfb019060bb8f455742b683510be9e98a22a16542c91b9a67b5"
            },
            "downloads": -1,
            "filename": "ormspace-0.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7d7f2e4d5500608b075dd428465003c5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 20019,
            "upload_time": "2024-05-26T23:59:35",
            "upload_time_iso_8601": "2024-05-26T23:59:35.708929Z",
            "url": "https://files.pythonhosted.org/packages/38/b2/f09efd650ca16d2f76b608d0fc74fe85ed19bf645b87f28a8116d5593a2f/ormspace-0.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "099ce76a5828657a4bcb200fadb449d939843accf626d9fdca34d73bba3dfbb3",
                "md5": "edc95f5b4338b267b19d8fc1b5c8064d",
                "sha256": "6e18385998608635818db45212b6c37c7f83c064c22b607040ab26074b97a953"
            },
            "downloads": -1,
            "filename": "ormspace-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "edc95f5b4338b267b19d8fc1b5c8064d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 16628,
            "upload_time": "2024-05-26T23:59:37",
            "upload_time_iso_8601": "2024-05-26T23:59:37.579521Z",
            "url": "https://files.pythonhosted.org/packages/09/9c/e76a5828657a4bcb200fadb449d939843accf626d9fdca34d73bba3dfbb3/ormspace-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-26 23:59:37",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "ormspace"
}
        
Elapsed time: 0.43135s