Skip to content

Add support for Flask-sqlalchemy 3.x #232

Description

@dartie

Flask-sqlalchemy 3.x causes the following error at the start:

$ python run.py 
Traceback (most recent call last):
  File "run.py", line 20, in <module>
    dashmachine_init()
  File "/home/username/Apps/DashMachine/dashmachine/main/utils.py", line 35, in dashmachine_init
    db.create_all()
  File "/home/username/Apps/DashMachine/venv-DashMachine/lib/python3.8/site-packages/flask_sqlalchemy/extension.py", line 868, in create_all
    self._call_for_binds(bind_key, "create_all")
  File "/home/username/Apps/DashMachine/venv-DashMachine/lib/python3.8/site-packages/flask_sqlalchemy/extension.py", line 839, in _call_for_binds
    engine = self.engines[key]
  File "/home/username/Apps/DashMachine/venv-DashMachine/lib/python3.8/site-packages/flask_sqlalchemy/extension.py", line 628, in engines
    app = current_app._get_current_object()  # type: ignore[attr-defined]
  File "/home/username/Apps/DashMachine/venv-DashMachine/lib/python3.8/site-packages/werkzeug/local.py", line 513, in _get_current_object
    raise RuntimeError(unbound_message) from None
RuntimeError: Working outside of application context.

This typically means that you attempted to use functionality that needed
the current application. To solve this, set up an application context
with app.app_context(). See the documentation for more information.

The workaround is installing 2.5.1 instead.

Request: add support for Flask-sqlalchemy 3.x

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions