title: Python SQLAlchemy: AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema'
body: <p>I tried creating a new database in my project, but I got this error when I run the script, I have another project using similar definition, it worked before, but now it get the same error now.
  I am using Python 2.7.8 and the version of SQLAlchemy module is 0.9.8.
  By the way, a project used Flask-SQLAlchemy, it works well.
  I am confused.
  The traceback information is following:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;D:/Projects/OO-IM/db_create.py&quot;, line 4, in &lt;module&gt;
      from models import Base
    File &quot;D:\Projects\OO-IM\models.py&quot;, line 15, in &lt;module&gt;
      Column('followed_id', Integer(), ForeignKey('user.id'))
    File &quot;C:\Python27\lib\site-packages\sqlalchemy\sql\schema.py&quot;, line 369, in __new__
      schema = metadata.schema
    File &quot;C:\Python27\lib\site-packages\sqlalchemy\sql\elements.py&quot;, line 662, in __getattr__
      key)
  AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema'
  
  
  from sqlalchemy import (create_engine, Column, 
    String, Integer, Text, 
    DateTime, Boolean, 
    ForeignKey, Table)
  
  from sqlalchemy.orm import sessionmaker, relationship, backref
  from sqlalchemy.ext.declarative import declarative_base
  
  SQLALCHEMY_DATABASE_URI = &quot;mysql://root:mysqladmin@localhost:3306/oo_im?charset=utf8&quot;
  
  Base = declarative_base()
  
  # TODO:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema'
  friendships = Table('friendships',
                      Column('follower_id', Integer(), ForeignKey('user.id')),
                      Column('followed_id', Integer(), ForeignKey('user.id'))
  )
  
  
  class User(Base):
      __tablename__ = 'user'
      id = Column(Integer(), primary_key=True)
      account = Column(String(32), unique=True, nullable=False)
      password = Column(String(32), nullable=False)
      followed = relationship(&quot;User&quot;,
                              secondary=friendships,
                              primaryjoin=(friendships.c.follower_id == id),
                              secondaryjoin=(friendships.c.followed_id == id),
                              backref=backref(&quot;followers&quot;, lazy=&quot;dynamic&quot;),
                              lazy=&quot;dynamic&quot;)
  
      def __init__(self, account, password, followed=None):
          self.account = account
          self.password = password
  
          if followed:
              for user in followed:
                  self.follow(user)
  
      def follow(self, user):
          if not self.is_following(user):
              self.followed.append(user)
              return self
  
      def unfollow(self, user):
          if self.is_following(user):
              self.followed.remove(user)
              return self
  
      def is_following(self, user):
          return self.followed.filter(friendships.c.followed_id == user.id).count() &gt; 0
  
  
  class ChatLog(Base):
      __tablename__ = 'chatlog'
      id = Column(Integer(), primary_key=True)
      sender_id = Column(Integer(), ForeignKey('user.id'), nullable=False)
      receiver_id = Column(Integer(), ForeignKey('user.id'), nullable=False)
      send_time = Column(DateTime(), nullable=False)
      received = Column(Boolean(), default=False)
      content = Column(Text(), nullable=False)
  
  
  engine = create_engine(SQLALCHEMY_DATABASE_URI, convert_unicode=True)
  DBSession = sessionmaker(bind=engine)
  </code></pre>