While working on the python flask I got the below error and when I tried to debug more then I reliaze that this is not the culprit.
- self.dialect.do_execute(
- File "C:\Program Files\Python38\lib\site-packages\sqlalchemy\engine\default.py", line 552, in do_execute
- cursor.execute(statement, parameters)
- sqlalchemy.exc.OperationalError: (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely)
- (sqlite3.OperationalError) no such table: user
- [SQL: INSERT INTO user (username, email, password_hash) VALUES (?, ?, ?)]
- [parameters: ('Vipin', 'XX.i.kumar@gmail.com', None)]
- (Background on this error at: http://sqlalche.me/e/e3q8)
Now When the ouput of the command falsk db migrate been checked, then got the root issue, problem was
warnings.warn(
c:\program files\python38\lib\site-packages\flask_sqlalchemy\__init__.py:834: FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future. Set it to True or False to suppress this warning.
warnings.warn(FSADeprecationWarning(
INFO [alembic.runtime.migration] Context impl SQLiteImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
ERROR [root] Error: Target database is not up to date.
After reading a number of post concluded issue the the new migration folder which get created when we run the follwoing command.
flask db migrate
Now I rename the migration folder to xmigration. then re-run the script from
flask db init
flask db migrate -m 'user table'
Now it created the migration folder again and then next command also a success.
I am still not able to reach to root of the issue, will see it in some time, but till then happy solutioning.
No comments:
Post a Comment