eve-sqlalchemy icon indicating copy to clipboard operation
eve-sqlalchemy copied to clipboard

DOC: Better documentation for using flask-sqlalchemy

Open mandarvaze opened this issue 9 years ago • 2 comments

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 avatar Jul 14 '15 19:07 mandarvaze

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

mandarvaze avatar Jul 16 '15 07:07 mandarvaze

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 :(

amleczko avatar Sep 18 '15 09:09 amleczko