Name | ormspace JSON |
Version |
0.3.0
JSON |
| download |
home_page | |
Summary | Pydantic models working with deta.space api, including ORM features. |
upload_time | 2024-01-26 02:02:52 |
maintainer | |
docs_url | None |
author | Daniel Arantes |
requires_python | >=3.9,<4.0 |
license | MIT |
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": "",
"name": "ormspace",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "Daniel Arantes",
"author_email": "arantesdv@me.com",
"download_url": "https://files.pythonhosted.org/packages/d1/7e/bffb0b910e7bc4edc22e186cf375d4862dbbac2f6f6334f7974a3e4d4a6c/ormspace-0.3.0.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.0",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "08d8e09fd4ea5d0e9197f6f1ddbe88ee8884246f7690338ba4890dea5ac38aab",
"md5": "8b0e188c9b590ba25fada99a26ef19c3",
"sha256": "0115e0ae6bde983179d4a4b6e141a751e2297a581c00884e96143b5bfd87c503"
},
"downloads": -1,
"filename": "ormspace-0.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8b0e188c9b590ba25fada99a26ef19c3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9,<4.0",
"size": 20091,
"upload_time": "2024-01-26T02:02:49",
"upload_time_iso_8601": "2024-01-26T02:02:49.264546Z",
"url": "https://files.pythonhosted.org/packages/08/d8/e09fd4ea5d0e9197f6f1ddbe88ee8884246f7690338ba4890dea5ac38aab/ormspace-0.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d17ebffb0b910e7bc4edc22e186cf375d4862dbbac2f6f6334f7974a3e4d4a6c",
"md5": "fcd3cc93862e10cbbaa6809ae6895239",
"sha256": "eb300ccc9d470ed2a6958c10b641307ef9dd4b090019001adbd7864d54b8b32d"
},
"downloads": -1,
"filename": "ormspace-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "fcd3cc93862e10cbbaa6809ae6895239",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9,<4.0",
"size": 16672,
"upload_time": "2024-01-26T02:02:52",
"upload_time_iso_8601": "2024-01-26T02:02:52.282404Z",
"url": "https://files.pythonhosted.org/packages/d1/7e/bffb0b910e7bc4edc22e186cf375d4862dbbac2f6f6334f7974a3e4d4a6c/ormspace-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-26 02:02:52",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "ormspace"
}