Attributeerror: Can't Set Attribute When Connecting to SQLite Database with Flask-Sqlalchemy

Flask-SQLAlchemy AttributeError: can't set attribute

Downgrading SQLAlchemy to anything lower than 1.4.0 (1.3.8 in my case) solves the problem.

AttributeError: can't set attribute when connecting to sqlite database with flask-sqlalchemy

Edit

If you're experiencing this, upgrading Flask-SQLAlchemy to >= 2.5 should resolve the issue per https://github.com/pallets/flask-sqlalchemy/issues/910#issuecomment-802098285.

Pinning SQLAlchemy to ~1.3 should no longer be necessary.


I ran into this issue a little earlier, but think I've figured out what's going on.

SQLAlchemy is automatically installed as a dependency for Flask-SQLAlchemy and its latest release (1.4.0) introduces the following breaking change:

The URL object is now an immutable named tuple. To modify a URL object, use the URL.set() method to produce a new URL object.

I was able to fix this issue by simply installing the previous version of SQL Alchemy (1.3.23).

Flask SQLAlchemy can't set attribute error in a venv

I recently delt with that same error message. It is actually due to an upgrade in SQLAlchemy, which gets installed as a dependency of flask-sqlalchemy.

You can find the question I posted on stackoverflow for the issue here:

The problem gets solved by uninstalling SQLAlchemy==1.4.0 and installing the previous version SQLAlchemy==1.3.23.

Try doing that in your virtual environ and see if it helps.

Flask SQLAlchemy db.create_all(app = app) can't set attribute

I have solved the problem by Downgrading the SQLAlchemy . For some reason the latest version is not working

pip install 'SQLAlchemy<1.4.0'



Related Topics



Leave a reply



Submit