{ "info": { "author": "Juan Batiz-Benet", "author_email": "juan@benet.ai", "bugtrack_url": null, "classifiers": [ "Topic :: Database" ], "description": "# datastore.objects\n\n[`datastore.objects`](https://github.com/datastore/datastore.objects) is a\nsimple *object mapper* on top of\n[`datastore`](https://github.com/jbenet/datastore) (not relational). Thanks to\ndatastore's versatility, it makes it easy to (serialize and) persist custom\nclasses to any sort of data storage service.\n\nNotice: please familiarize yourself with `datastore` first.\n\n## Install\n\n\n pip install datastore.objects\n\n\n## Interface\n\n### Key\n\n`datastore.objects` uses the default `datastore.Key`, making significant use\nof the `type` and `instance` fragments.\n\n```python\n>>> from datastore.objects import Key, Model\n>>> class Scientist(Model):\n>>> pass\n>>> Scientist.key\nKey('/Scientist')\n>>> Scientist('Tesla').key\nKey('/Scientist:Tesla')\n```\n\n\n### Model\n\n`datastore.objects` provides a class that you inherit from to define your\nmodels. datastore.objects.Model handles the datastore serializing and\ndeserializing, attribute validation, etc.\n\n```python\n>>> from datastore.objects import Model\n>>> class Scientist(Model):\n>>> pass\n```\n\n\n### Attribute\n\n`datastore.objects` uses descriptor Attributes to track the properties you wish\nto store. This is heavily based on how other python ORMs (django, app engine)\ndo it. In short, you define model attributes like this:\n\n\n```python\n>>> from datastore.objects import Attribute, Model\n>>> class Scientist(Model):\n>>> name = Attribute(required=True)\n>>> field = Attribute(default='Physics')\n>>> tesla = Scientist('Tesla')\n>>> tesla.name = 'Nicola Tesla'\n>>> tesla.field\n'Physics'\n>>> tesla.field = 'Electrical Engineering'\n>>> tesla.data\n{'name': 'Nicola Tesla', 'field': 'Electrical Engineering'}\n```\n\n### ObjectDatastore\n\n`datastore.objects` provides a `ShimDatastore` that wraps any other datastore.\nThus you can use any of the various datastores to persist your objects.\n`ObjectDatastore` makes sure to serialize (on put) and deserialize (on get)\ndata properly, and construct your classes.\n\n```python\n>>> import datastore\n>>> from datastore.objects import Attribute, Model, ObjectDatastore\n>>>\n>>> class Scientist(Model):\n>>> name = Attribute(required=True)\n>>> field = Attribute(default='Physics')\n>>>\n>>> tesla = Scientist('Tesla')\n>>> tesla.name = 'Tesla'\n>>> tesla.field = 'Electrical Engineering'\n>>>\n>>> dds = datastore.DictDatastore()\n>>> ods = ObjectDatastore(dds, model=Scientist)\n>>> ods.put(tesla.key, tesla)\n>>> dds.get(tesla.key)\n{'name': 'Tesla', 'field': 'Electrical Engineering'}\n>>> ods.get(tesla.key)\n\n```\n\n\n## About\n\n#### Author\n\n`datastore.objects` is written by [Juan Batiz-Benet](https://github.com/jbenet),\nof [Athena](http://athena.ai).\n\n#### License\n\nIt is free open-source software, available under\nthe MIT License.\n\n#### Contact\n\nProject webpage: https://github.com/datastore/datastore.objects.\nIssues: https://github.com/jbenet/object-datastore/issues", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/datastore/datastore.objects", "keywords": "datastore,object mapper,ORM,serializing", "license": "MIT License", "maintainer": null, "maintainer_email": null, "name": "datastore.objects", "package_url": "https://pypi.org/project/datastore.objects/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/datastore.objects/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/datastore/datastore.objects" }, "release_url": "https://pypi.org/project/datastore.objects/0.2.3/", "requires_dist": null, "requires_python": null, "summary": "object mapper for datastore", "version": "0.2.3" }, "last_serial": 788819, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "0849958cd531f055f9761e23417ab52b", "sha256": "db6553cac67aab6879e48be959647f06725429560f1d352d1579b36e3d633bd6" }, "downloads": -1, "filename": "datastore.objects-0.1.0.tar.gz", "has_sig": false, "md5_digest": "0849958cd531f055f9761e23417ab52b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10605, "upload_time": "2013-02-15T13:17:55", "url": "https://files.pythonhosted.org/packages/be/ad/b81a182d03fd5a708cbbd8e0e3023d4d8a57342d789a0d1f5cbd2c9c4c63/datastore.objects-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "491de613576d15d169bf0dda3da2fe58", "sha256": "4e15a74df079973ac938456005cd54f7cc3a8e7bb14c96ca9a39eedcd6f2fdd1" }, "downloads": -1, "filename": "datastore.objects-0.2.0.tar.gz", "has_sig": false, "md5_digest": "491de613576d15d169bf0dda3da2fe58", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10745, "upload_time": "2013-04-22T07:21:07", "url": "https://files.pythonhosted.org/packages/93/b7/4a8fd3c5abc5bb98ba4205117b5354cf9ba265a8fc950f534e3021608b6f/datastore.objects-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "2e0103069bd9f154cd3d87320fd70632", "sha256": "3e00f79abe22491c9fa3d2a03bed4011b042987d446144017017928009fc7217" }, "downloads": -1, "filename": "datastore.objects-0.2.1.tar.gz", "has_sig": false, "md5_digest": "2e0103069bd9f154cd3d87320fd70632", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10763, "upload_time": "2013-04-22T09:28:22", "url": "https://files.pythonhosted.org/packages/f1/2d/33a850614f84ee18860b0e2d17c7ec50d6faf8c7031db7bad9291979fef2/datastore.objects-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "1f8cf9d2d6f71e2e0f164af5b25bff45", "sha256": "418465156297f8afe0b2c56f427c9fc8168b9e239337a9bf928e9d199a9f1b6d" }, "downloads": -1, "filename": "datastore.objects-0.2.2.tar.gz", "has_sig": false, "md5_digest": "1f8cf9d2d6f71e2e0f164af5b25bff45", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 35870, "upload_time": "2013-06-27T15:04:54", "url": "https://files.pythonhosted.org/packages/3c/a4/20d30e609014d98c0a1ca0b2057531b2fd589926f7ab0081760f36a9f526/datastore.objects-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "bac25932a1e6ce3069a7add2e29b6c35", "sha256": "bf243ab33d1355a52fdcbd4b6b703b4b6a942e9551947b46b3d44c3b58081ff6" }, "downloads": -1, "filename": "datastore.objects-0.2.3.tar.gz", "has_sig": false, "md5_digest": "bac25932a1e6ce3069a7add2e29b6c35", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 35876, "upload_time": "2013-06-27T15:06:32", "url": "https://files.pythonhosted.org/packages/e9/70/99c8a01be203d05b4d8d34c827a2eb0d2e4cfce0eed4b62d77687ce8029a/datastore.objects-0.2.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "bac25932a1e6ce3069a7add2e29b6c35", "sha256": "bf243ab33d1355a52fdcbd4b6b703b4b6a942e9551947b46b3d44c3b58081ff6" }, "downloads": -1, "filename": "datastore.objects-0.2.3.tar.gz", "has_sig": false, "md5_digest": "bac25932a1e6ce3069a7add2e29b6c35", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 35876, "upload_time": "2013-06-27T15:06:32", "url": "https://files.pythonhosted.org/packages/e9/70/99c8a01be203d05b4d8d34c827a2eb0d2e4cfce0eed4b62d77687ce8029a/datastore.objects-0.2.3.tar.gz" } ] }