# Flask-RESTAlchemy #
[![build](https://github.com/ESSS/serialchemy/workflows/build/badge.svg)](https://github.com/ESSS/serialchemy/actions)
[![codecov](https://codecov.io/gh/ESSS/flask-restalchemy/branch/master/graph/badge.svg)](https://codecov.io/gh/ESSS/flask-restalchemy)
[![black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![black](https://img.shields.io/readthedocs/flask-restalchemy.svg)](https://flask-restalchemy.readthedocs.io/en/latest)
A Flask extension to build REST APIs. It dismiss the need of building *Schema* classes,
since usually all the information needed to serialize an SQLAlchemy instance is in the model
itself.
By adding a model to the API, all its properties will be exposed:
```python
class User(Base):
__tablename__ = "User"
id = Column(Integer, primary_key=True)
firstname = Column(String)
lastname = Column(String)
email = Column(String)
password = Column(String)
api = Api(flask_app)
api.add_model(User, "/user")
```
To change the way properties are serialized, declare only the one that needs a non-default
behaviour:
```python
from serialchemy import ModelSerializer, Field
class UserSerializer(ModelSerializer):
password = Field(load_only=True)
api = Api(flask_app)
api.add_model(User, "/user", serializer_class=UserSerializer)
```
### Release
A reminder for the maintainers on how to make a new release.
Note that the VERSION should folow the semantic versioning as X.Y.Z
Ex.: v1.0.5
1. Create a ``release-VERSION`` branch from ``upstream/master``.
2. Update ``CHANGELOG.rst``.
3. Push a branch with the changes.
4. Once all builds pass, push a ``VERSION`` tag to ``upstream``.
5. Merge the PR.
[Changelog]: https://regro.github.io/rever-docs/devguide.html#changelog
Raw data
{
"_id": null,
"home_page": "https://github.com/ESSS/flask-restalchemy",
"name": "flask-restalchemy",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "flask sqlalchemy orm",
"author": "ESSS",
"author_email": "foss@esss.co",
"download_url": "https://files.pythonhosted.org/packages/7f/7e/d85ded2efd36b93e720f4c02133c952ee293a3a40c1d86706f44d53a275d/flask-restalchemy-0.14.1.tar.gz",
"platform": null,
"description": "# Flask-RESTAlchemy #\n\n[![build](https://github.com/ESSS/serialchemy/workflows/build/badge.svg)](https://github.com/ESSS/serialchemy/actions)\n[![codecov](https://codecov.io/gh/ESSS/flask-restalchemy/branch/master/graph/badge.svg)](https://codecov.io/gh/ESSS/flask-restalchemy)\n[![black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![black](https://img.shields.io/readthedocs/flask-restalchemy.svg)](https://flask-restalchemy.readthedocs.io/en/latest)\n\nA Flask extension to build REST APIs. It dismiss the need of building *Schema* classes,\nsince usually all the information needed to serialize an SQLAlchemy instance is in the model\nitself.\n\nBy adding a model to the API, all its properties will be exposed:\n\n```python\nclass User(Base):\n\n __tablename__ = \"User\"\n\n id = Column(Integer, primary_key=True)\n firstname = Column(String)\n lastname = Column(String)\n email = Column(String)\n password = Column(String)\n\n\napi = Api(flask_app)\napi.add_model(User, \"/user\")\n```\n\nTo change the way properties are serialized, declare only the one that needs a non-default\nbehaviour:\n\n```python\nfrom serialchemy import ModelSerializer, Field\n\n\nclass UserSerializer(ModelSerializer):\n\n password = Field(load_only=True)\n\n\napi = Api(flask_app)\napi.add_model(User, \"/user\", serializer_class=UserSerializer)\n```\n\n### Release\nA reminder for the maintainers on how to make a new release.\n\nNote that the VERSION should folow the semantic versioning as X.Y.Z\nEx.: v1.0.5\n\n1. Create a ``release-VERSION`` branch from ``upstream/master``.\n2. Update ``CHANGELOG.rst``.\n3. Push a branch with the changes.\n4. Once all builds pass, push a ``VERSION`` tag to ``upstream``.\n5. Merge the PR.\n\n[Changelog]: https://regro.github.io/rever-docs/devguide.html#changelog\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Flask extension to build REST APIs based on SQLAlchemy models",
"version": "0.14.1",
"project_urls": {
"Homepage": "https://github.com/ESSS/flask-restalchemy"
},
"split_keywords": [
"flask",
"sqlalchemy",
"orm"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "058fc10cff11a9f62fee2657c055041626d2ef204366c52a6326ae925a3d084f",
"md5": "baed2db1c55e19f3e17cdca04e5f53a0",
"sha256": "72c638c47f61f38fbeae228c87e7aa7b0c092f706163d43983b282763a8bf509"
},
"downloads": -1,
"filename": "flask_restalchemy-0.14.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "baed2db1c55e19f3e17cdca04e5f53a0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 28817,
"upload_time": "2023-11-27T17:41:59",
"upload_time_iso_8601": "2023-11-27T17:41:59.610706Z",
"url": "https://files.pythonhosted.org/packages/05/8f/c10cff11a9f62fee2657c055041626d2ef204366c52a6326ae925a3d084f/flask_restalchemy-0.14.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7f7ed85ded2efd36b93e720f4c02133c952ee293a3a40c1d86706f44d53a275d",
"md5": "07f5500faa0a038c16f340c95c4d7a66",
"sha256": "6648ae2590c7c1f1bdffa1a7acd263ab2fbc96b8143307e3d810aae01696bf0f"
},
"downloads": -1,
"filename": "flask-restalchemy-0.14.1.tar.gz",
"has_sig": false,
"md5_digest": "07f5500faa0a038c16f340c95c4d7a66",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 26927,
"upload_time": "2023-11-27T17:42:00",
"upload_time_iso_8601": "2023-11-27T17:42:00.997436Z",
"url": "https://files.pythonhosted.org/packages/7f/7e/d85ded2efd36b93e720f4c02133c952ee293a3a40c1d86706f44d53a275d/flask-restalchemy-0.14.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-27 17:42:00",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ESSS",
"github_project": "flask-restalchemy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "flask",
"specs": [
[
"==",
"1.0.2"
]
]
},
{
"name": "sqlalchemy",
"specs": [
[
"==",
"1.3.0"
]
]
},
{
"name": "sqlalchemy_utils",
"specs": [
[
">=",
"0.30"
]
]
},
{
"name": "flask-sqlalchemy",
"specs": [
[
">=",
"2.3.0"
]
]
},
{
"name": "serialchemy",
"specs": [
[
">=",
"0.3.0"
]
]
},
{
"name": "pytest",
"specs": [
[
"==",
"4.0.2"
]
]
},
{
"name": "pytest-datadir",
"specs": []
},
{
"name": "pytest-regressions",
"specs": [
[
"==",
"1.0.5"
]
]
},
{
"name": "pytest-mock",
"specs": [
[
">=",
"1.10.0"
]
]
}
],
"tox": true,
"lcname": "flask-restalchemy"
}