title: Need Help: AttributeError: "SQLAlchemy" object has no attribute 'Models'
body: <p>AttributeError: sqlalchemy object has no attribute "Models" error is occurring. I already installed all requirements like pip install sqlalchemy, flask-sqlalchemy, psycopy2-binary. this file name is create.py</p>
  
  <pre><code>import os
  
  from flask import Flask, render_template, request
  from models import *
  
  app = Flask(__name__)
  
  app.config["SQLALchemy_DATABASE_URI"] = os.getenv("DATABASE_URL")
  app.config["SQLALchemy_TRACK_MODIFICATIONS"] = False
  db.init_app(app)
  
  def main():
     db.create_all()
  if __name__ == "__main__":
      with app.app_context():
          main()
  </code></pre>
  
  <p>this file is models.py</p>
  
  <pre><code> from flask_sqlalchemy import SQLAlchemy
  
  db=SQLAlchemy()
  
  class Flight(db.Models):
      __tablename__ = "flights"
      id = db.Column(db.Integer, primary_key=True)
      origin = db.Column(db.String, nullable=False)
      destination = db.Column(db.String, nullable=False)
      duration = db.Column(db.Integer, nullable=False)
  
  class Passenger(db.Models):
      __tablename__ = "passengers"
      id = db.Column(db.Integer, primary_key=True)
      name = db.Column(db.String, nullable=False)
      flight_id = db.Column(db.Integer, db.ForeignKey("flights.id", 
  nullable=False))
  </code></pre>
  
  <p>output is: </p>
  
  <p>Traceback (most recent call last):
    File "create.py", line 4, in 
      from models import *
    File "D:\web\flaskrun\models.py", line 5, in 
      class Flight(db.Models):
  AttributeError: 'SQLAlchemy' object has no attribute 'Models'</p>