{ "info": { "author": "Maarten De Paepe", "author_email": "\"maarten.de.paepe@gmail.com\"", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Programming Language :: Python", "Programming Language :: Python :: 3.6" ], "description": "[![Build Status](https://travis-ci.com/maarten-dp/flask-restless-datamodel.svg?branch=master)](https://travis-ci.com/maarten-dp/flask-restless-datamodel)\n[![Codecov](https://codecov.io/gh/maarten-dp/flask-restless-datamodel/branch/master/graph/badge.svg)](https://codecov.io/gh/maarten-dp/flask-restless-datamodel)\n[![PyPI version](https://badge.fury.io/py/flask-restless-datamodel.svg)](https://pypi.org/project/flask-restless-datamodel/)\n\n## Purpose\n\nThis library is one part of a two part piece of code. It fulfills the server part to the flask-restless client. What it does is allow you to render your datamodel in a convinient JSON format.\nThis JSON format is then read by the flask-restless-client, which in turn uses it to built itself, allowing for transparent access to your data model through HTTP.\n\n## Quickstart\n\nEnabling this feature is as easy as registering an SQLAlchemy model in flask-restless. The only thing you need to do, is import the DataModel class from the library and use it to register your api.\n\n```python\nimport flask\nimport flask_restless\nfrom flask_sqlalchemy import SQLAlchemy\nfrom flask_restless_datamodel import DataModel\nfrom my_models import Person, Computer, db\n\napp = flask.Flask(__name__)\ndb = SQLAlchemy(app)\n\n#Create a datamodel instance to register later\ndata_model = DataModel(manager)\n\nmanager = flask_restless.APIManager(app, flask_sqlalchemy_db=db)\nmanager.create_api(Person, methods=['GET'], include_columns=['name'])\nmanager.create_api(Computer, methods=['GET'], collection_name='compjutahs', exclude_columns=['name'])\nmanager.create_api(data_model, methods=['GET'])\n```\n\nWhich will expose an endpoint `http://localhost:5000/flask-restless-datamodel` which in turn will yield a result as followed\n\n```json\n{\n \"Computer\":{\n \"attributes\":{\n \"id\":\"integer\",\n \"owner_id\":\"integer\",\n \"owner_name\":\"unicode\",\n \"purchase_time\":\"datetime\",\n \"vendor\":\"unicode\"\n },\n \"collection_name\":\"compjutahs\",\n \"methods\":{},\n \"pk_name\":\"id\",\n \"relations\":{\n \"owner\":{\n \"backref\":\"computers\",\n \"foreign_model\":\"Person\",\n \"local_column\":\"owner_id\",\n \"relation_type\":\"MANYTOONE\"\n },\n \"peers\":{\n \"foreign_model\":\"Computer\",\n \"is_proxy\":true,\n \"relation_type\":\"MANYTOONE\"\n }\n }\n },\n \"Person\":{\n \"attributes\":{\n \"name\":\"unicode\"\n },\n \"collection_name\":\"person\",\n \"methods\":{},\n \"pk_name\":\"id\",\n \"relations\":{\n\n }\n }\n}\n```\n\nThis result will be used by the client code to build models on the fly.\n\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/maarten-dp/flask-restless-datamodel", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "flask-restless-datamodel", "package_url": "https://pypi.org/project/flask-restless-datamodel/", "platform": "", "project_url": "https://pypi.org/project/flask-restless-datamodel/", "project_urls": { "Homepage": "https://github.com/maarten-dp/flask-restless-datamodel" }, "release_url": "https://pypi.org/project/flask-restless-datamodel/0.0.3/", "requires_dist": [ "cereal-lazer (==0.0.3)", "flask-restless (==0.17.0)", "pbr (>=3.0)" ], "requires_python": "", "summary": "Server side code to expose a datamodel for the flask-restless client", "version": "0.0.3" }, "last_serial": 5388308, "releases": { "0.0.2": [ { "comment_text": "", "digests": { "md5": "834161b0e95e6c2b48fe5406606e913b", "sha256": "d09b84375afa3ad21a549f5b8f718289fb426e1870b7386d37464a16b6e6b8e4" }, "downloads": -1, "filename": "flask_restless_datamodel-0.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "834161b0e95e6c2b48fe5406606e913b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9535, "upload_time": "2019-06-11T20:39:32", "url": "https://files.pythonhosted.org/packages/11/5e/95de0a09e29684e12760704a287f6ad1ad0fb24081e0e83c9f51de1a4e58/flask_restless_datamodel-0.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0a52e5b480b7ff9b4e52e4e4d06eaa1d", "sha256": "fc504b687cd8f043a4d09a875af9acda0bee107b6f3d6c1e9501b550037667ba" }, "downloads": -1, "filename": "flask-restless-datamodel-0.0.2.tar.gz", "has_sig": false, "md5_digest": "0a52e5b480b7ff9b4e52e4e4d06eaa1d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12093, "upload_time": "2019-06-11T20:39:35", "url": "https://files.pythonhosted.org/packages/7e/2a/376f760035e4beb4068ae8f51eada5afaaf2e7c48f47247968e341761ca9/flask-restless-datamodel-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "43528d734a3defc21e646fcfd1a24bae", "sha256": "e6f1469a52f342d1c7b994471731666378c4ba0249e806013a50e5f4409a022a" }, "downloads": -1, "filename": "flask_restless_datamodel-0.0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "43528d734a3defc21e646fcfd1a24bae", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9532, "upload_time": "2019-06-11T20:49:54", "url": "https://files.pythonhosted.org/packages/07/2b/a7d998b1f7fe40cc6f44d339620e3a963b8b13a9e5bfe8cf953b4979499c/flask_restless_datamodel-0.0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9efa0b3da9eee13ef6bc4cf30cb36008", "sha256": "8df84204845ca7d37049cd7f8029faf6f2b538543453ea23a5ac25129fb23ac4" }, "downloads": -1, "filename": "flask-restless-datamodel-0.0.3.tar.gz", "has_sig": false, "md5_digest": "9efa0b3da9eee13ef6bc4cf30cb36008", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12114, "upload_time": "2019-06-11T20:49:55", "url": "https://files.pythonhosted.org/packages/7d/53/4b97ca703a343121d5062b8e8cfc67bbcd92515ef7792970606318068a9f/flask-restless-datamodel-0.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "43528d734a3defc21e646fcfd1a24bae", "sha256": "e6f1469a52f342d1c7b994471731666378c4ba0249e806013a50e5f4409a022a" }, "downloads": -1, "filename": "flask_restless_datamodel-0.0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "43528d734a3defc21e646fcfd1a24bae", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9532, "upload_time": "2019-06-11T20:49:54", "url": "https://files.pythonhosted.org/packages/07/2b/a7d998b1f7fe40cc6f44d339620e3a963b8b13a9e5bfe8cf953b4979499c/flask_restless_datamodel-0.0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9efa0b3da9eee13ef6bc4cf30cb36008", "sha256": "8df84204845ca7d37049cd7f8029faf6f2b538543453ea23a5ac25129fb23ac4" }, "downloads": -1, "filename": "flask-restless-datamodel-0.0.3.tar.gz", "has_sig": false, "md5_digest": "9efa0b3da9eee13ef6bc4cf30cb36008", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12114, "upload_time": "2019-06-11T20:49:55", "url": "https://files.pythonhosted.org/packages/7d/53/4b97ca703a343121d5062b8e8cfc67bbcd92515ef7792970606318068a9f/flask-restless-datamodel-0.0.3.tar.gz" } ] }