All Projects → pyeve → Eve Sqlalchemy

pyeve / Eve Sqlalchemy

Licence: other
SQLAlchemy data layer for Eve-powered RESTful APIs

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Eve Sqlalchemy

Flask movie site
用Flask构建一个微电影视频网站
Stars: ✭ 97 (-54.88%)
Mutual labels:  sqlalchemy, flask
Flask Graphene Sqlalchemy
A demo project for Flask + GraphQL (With Graphene & SQLAlchemy)
Stars: ✭ 117 (-45.58%)
Mutual labels:  sqlalchemy, flask
Booklibrary
📚Simple Book library application written on flask with SQLite database.
Stars: ✭ 98 (-54.42%)
Mutual labels:  sqlalchemy, flask
Flask Tutorial
这个项目已经很久很久了, 不推荐看, 不过倒是可以进群叨逼叨一下. 🚗 交流群:630398887
Stars: ✭ 91 (-57.67%)
Mutual labels:  sqlalchemy, flask
Flask Restless Security
Concise skeleton for development of Flask, Flask-Restless, SQLAlchemy, JWT based REST APIs.
Stars: ✭ 159 (-26.05%)
Mutual labels:  sqlalchemy, flask
Markbj
一个开放的知识社区
Stars: ✭ 94 (-56.28%)
Mutual labels:  sqlalchemy, flask
Flask Graphene Sqlalchemy
⚗️Project template to build a GraphQL API in Python
Stars: ✭ 109 (-49.3%)
Mutual labels:  sqlalchemy, flask
Eve Building Restful Mongodb Backed Apis Course
Course materials and handouts for EVE: Building RESTful MongoDB-backed APIs course
Stars: ✭ 53 (-75.35%)
Mutual labels:  rest, flask
Appkernel
API development made easy: a smart Python 3 API framework
Stars: ✭ 152 (-29.3%)
Mutual labels:  rest, flask
Tedivms Flask
Flask starter app with celery, bootstrap, and docker environment
Stars: ✭ 142 (-33.95%)
Mutual labels:  sqlalchemy, flask
Indico
Indico - A feature-rich event management system, made @ CERN, the place where the Web was born.
Stars: ✭ 1,160 (+439.53%)
Mutual labels:  sqlalchemy, flask
Flusk
Boilerplate API on how to structure big Flask applications (includes SQLAlchemy, Docker, nginx)
Stars: ✭ 165 (-23.26%)
Mutual labels:  sqlalchemy, flask
Ziggurat foundations
Framework agnostic set of sqlalchemy classes that make building applications that require permissions an easy task.
Stars: ✭ 67 (-68.84%)
Mutual labels:  sqlalchemy, flask
Flask Rest Template
template for a rest app with flask, flask-rest and more...
Stars: ✭ 95 (-55.81%)
Mutual labels:  rest, flask
Flask Whooshee
Customizable Flask - SQLAlchemy - Whoosh integration
Stars: ✭ 66 (-69.3%)
Mutual labels:  sqlalchemy, flask
Weeklyreport
基于Flask的开源周报系统,快速docker部署
Stars: ✭ 102 (-52.56%)
Mutual labels:  sqlalchemy, flask
Hobbit Core
A flask project generator.
Stars: ✭ 49 (-77.21%)
Mutual labels:  sqlalchemy, flask
Flask Restx
Fork of Flask-RESTPlus: Fully featured framework for fast, easy and documented API development with Flask
Stars: ✭ 1,050 (+388.37%)
Mutual labels:  rest, flask
Sandman2
Automatically generate a RESTful API service for your legacy database. No code required!
Stars: ✭ 1,765 (+720.93%)
Mutual labels:  rest, sqlalchemy
Flask Msearch
Full text search for flask.
Stars: ✭ 164 (-23.72%)
Mutual labels:  sqlalchemy, flask

Eve-SQLAlchemy extension

.. image:: https://travis-ci.org/pyeve/eve-sqlalchemy.svg?branch=master :target: https://travis-ci.org/pyeve/eve-sqlalchemy

Powered by Eve, SQLAlchemy and good intentions this extension allows to effortlessly build and deploy highly customizable, fully featured RESTful Web Services with SQL-based backends.

Eve-SQLAlchemy is simple

The following code blocks are excerpts of examples/one_to_many and should give you an idea of how Eve-SQLAlchemy is used. A complete working example can be found there. If you are not familiar with Eve <https://python-eve.org/>_ and SQLAlchemy <https://www.sqlalchemy.org/>_, it is recommended to read up on them first.

For this example, we declare two SQLAlchemy mappings (from domain.py):

.. code-block:: python

class Parent(BaseModel):
    __tablename__ = 'parent'
    id = Column(Integer, primary_key=True)
    children = relationship("Child")

class Child(BaseModel):
    __tablename__ = 'child'
    id = Column(Integer, primary_key=True)
    parent_id = Column(Integer, ForeignKey('parent.id'))

As for Eve, a settings.py is used to configure our API. Eve-SQLAlchemy, having access to a lot of metadata from your models, can automatically generate a great deal of the DOMAIN dictionary for you:

.. code-block:: python

DEBUG = True
SQLALCHEMY_DATABASE_URI = 'sqlite://'
SQLALCHEMY_TRACK_MODIFICATIONS = False
RESOURCE_METHODS = ['GET', 'POST']

DOMAIN = DomainConfig({
    'parents': ResourceConfig(Parent),
    'children': ResourceConfig(Child)
}).render()

Finally, running our application server is easy (from app.py):

.. code-block:: python

app = Eve(validator=ValidatorSQL, data=SQL)

db = app.data.driver
Base.metadata.bind = db.engine
db.Model = Base

# create database schema on startup and populate some example data
db.create_all()
db.session.add_all([Parent(children=[Child() for k in range(n)])
                    for n in range(10)])
db.session.commit()

# using reloader will destroy the in-memory sqlite db
app.run(debug=True, use_reloader=False)

The API is now live, ready to be consumed:

.. code-block:: console

$ curl -s http://localhost:5000/parents | python -m json.tool

.. code-block:: json

{
    "_items": [
        {
            "_created": "Sun, 22 Oct 2017 07:58:28 GMT",
            "_etag": "f56d7cb013bf3d8449e11e8e1f0213f5efd0f07d",
            "_links": {
                "self": {
                    "href": "parents/1",
                    "title": "Parent"
                }
            },
            "_updated": "Sun, 22 Oct 2017 07:58:28 GMT",
            "children": [],
            "id": 1
        },
        {
            "_created": "Sun, 22 Oct 2017 07:58:28 GMT",
            "_etag": "dd1698161cb6beef04f564b2e18804d4a7c4330d",
            "_links": {
                "self": {
                    "href": "parents/2",
                    "title": "Parent"
                }
            },
            "_updated": "Sun, 22 Oct 2017 07:58:28 GMT",
            "children": [
                1
            ],
            "id": 2
        },
        "..."
    ],
    "_links": {
        "parent": {
            "href": "/",
            "title": "home"
        },
        "self": {
            "href": "parents",
            "title": "parents"
        }
    },
    "_meta": {
        "max_results": 25,
        "page": 1,
        "total": 10
    }
}

All you need to bring your API online is a database, a configuration file (defaults to settings.py) and a launch script. Overall, you will find that configuring and fine-tuning your API is a very simple process.

Eve-SQLAlchemy is thoroughly tested under Python 2.7-3.7 and PyPy.

Documentation

The offical project documentation can be accessed at eve-sqlalchemy.readthedocs.org <https://eve-sqlalchemy.readthedocs.org/>_. For full working examples, especially regarding different relationship types, see the examples directory in this repository.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].