Forums

Warning Importing flask.ext.sqlalchemy is deprecated, use flask_sqlalchemy instead.

I get this message below while starting SQL following this https://blog.pythonanywhere.com/121/ after executing a command line

from flask_app import db

on bash.

Does anyone have any ideas why I get this message? I could not find answer this forum or on google..

In [1]: from flask_app import db
/usr/local/lib/python3.4/dist-packages/flask/exthook.py:71: ExtDeprecationWarning: I
mporting flask.ext.sqlalchemy is deprecated, use flask_sqlalchemy instead.
  .format(x=modname), ExtDeprecationWarning
/usr/local/lib/python3.4/dist-packages/flask_sqlalchemy/__init__.py:800: UserWarning
: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by d
efault in the future.  Set it to True to suppress this warning.
  warnings.warn('SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will b
e disabled by default in the future.  Set it to True to suppress this warning.')

Those are both warnings rather than errors; you can probably ignore them. Do the tables get created in the database? You can see them by starting a MySQL console from the "Databases" tab, then running show tables;

Thank you, tried to create table, and show tables; gives me error - syntax error. I am checking the manual, do you know how I can find which version of mySQL I am using?

sql console: mysql> db.create_all() -> show tables; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'db.create_all() show tables' at line 1

db.create_all() is a Python function that runs code that sets up your database. It's not a MySQL function. Run it in a Python console where you've imported your db module.