Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLAlchemy and Flask application context #3

Open
ghost opened this issue Mar 17, 2017 · 2 comments
Open

SQLAlchemy and Flask application context #3

ghost opened this issue Mar 17, 2017 · 2 comments

Comments

@ghost
Copy link

ghost commented Mar 17, 2017

I get some issue with managing multiple SQLAlchemy db schema on my models when migration. I think, this is because of the flask application factory and application context design, referred from http://piotr.banaszkiewicz.org/blog/2012/06/29/flask-sqlalchemy-init_app/ .

Flask-SQLAlchemy has two usage modes.

Option 1

Binding the instance to a very specific Flask application

app = Flask(__name__)
db = SQLAlchemy(app)

Option 2

Create the object once and configure the application later to support it

db = SQLAlchemy()

def create_app():
    app = Flask(__name__)
    db.init_app(app)
    return app

The Openedoo core uses option 1, change the core to option 2 to help you make models migration in this module.

suggestions are welcome.

@ghost ghost mentioned this issue Mar 17, 2017
@rendiya
Copy link

rendiya commented Mar 19, 2017

yah di note dulu, antara rubah core atau module

@ghost
Copy link
Author

ghost commented Mar 19, 2017

yup, ini sebagai clue aja jika ada yang mau mencoba module ini.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant