title: AttributeError: '_Option' object has no attribute '_sa_instance_state' in flask
body: <p>I am using Flask for my app and getting <strong>AttributeError: '_Option' object has no attribute '_sa_instance_state'</strong> error. have no idea what it is about. I google it and it seems that it is a SQL-Alchemy issue. Could you please help me with that?</p>
  
  <p>here is my models.py:</p>
  
  <pre><code>#current table is used to make navigation hierarchy. eg. menu/submenu
  #eg. About Us (History, Mission, Vision)
  menu_hierarchy = db.Table('menu_hierarchy',
          db.Column('parent_id', db.Integer, db.ForeignKey('menu.id')),
          db.Column('child_id', db.Integer, db.ForeignKey('menu.id'))
      )
  
  class Menu(db.Model):
      """Menu is used for websites navigation titles.
      eg. Home/About Us/Blog/Contacts/and etc""" 
  
      id          = db.Column(db.Integer, primary_key = True)
      title       = db.Column(db.String(255))
      title_eng   = db.Column(db.String(255))
      alias       = db.Column(db.String(255))
      menu_type   = db.Column(db.String(10))
      ordering    = db.Column(db.SmallInteger, default = '1')
      check_out_time = db.Column(db.DateTime)
      access      = db.Column(db.String(30))
      published   = db.Column(db.SmallInteger, default = '1')
      parent_id   = db.relationship('Menu',
          secondary = menu_hierarchy,
          primaryjoin = (menu_hierarchy.c.parent_id == id),
          secondaryjoin = (menu_hierarchy.c.child_id == id),
          backref = db.backref('menu_hierarchy', lazy = 'dynamic'),
          lazy = 'dynamic')
      content     = db.Column(db.String)
      content_eng = db.Column(db.String)
      image       = db.Column(db.String(350))
  </code></pre>