pyeve / eve-sqlalchemy

SQLAlchemy data layer for Eve-powered RESTful APIs
http://eve-sqlalchemy.readthedocs.io
Other
232 stars 70 forks source link

DOC: Better documentation for using flask-sqlalchemy #54

Open mandarvaze opened 9 years ago

mandarvaze commented 9 years ago

The example from the docs doesn't make sense

from eve_sqlalchemy import SQL as _SQL
from flask_sqlalchemy import SQLAlchemy

db = SQLAlchemy(app)  # app is not defined yet

class SQL(_SQL):
   driver = db

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

When we create app, it requires SQL class, which requires db which in turn requires app which hasn't been defined yet.

There is also the "circular imports" issue. This caused my settings.py file to be bad, but the problem reported itself as DOMAIN dictionary missing or wrong which is misleading since I did have a settings.py file(magic filename) and it it did have DOMAIN dict defined as per the example.

mandarvaze commented 9 years ago

if eve-sqlalchemy already uses flask-sqlalchemy internally, then why the above section in the documentation ? Can you clarify ?

amleczko commented 9 years ago

I would like to skip using flask_sqlalchemyin the future cause it's a bit hard for people familiar with SQLAlachemy and not flask. I agree that the docs in that part are right now not consistent. I haven't got time to cleanup this part :(