title: why sqlalchemy expunge not work?
body: <p>Here is my code:</p>
  
  <pre><code>class Room(Base):
      __tablename__ = 'room'
  
      _id = Column('id', Integer, primary_key=True, autoincrement=True)
  
  
  def create_room(self):
      try:
          session = Session()
          new_room = Room()
          session.add(new_room)
          session.expunge(new_room)
          session.commit()
          session.close()
          return new_room
      except exc.IntegrityError as e:
          logger.error('create room error')
          logger.error(e)
          return None
  </code></pre>
  
  <p>I use expunge to detach the object from session, and then I print the room id:</p>
  
  <pre><code>room = room.create_room()
  logger.info('room %d created' % room._id)
  </code></pre>
  
  <p>but the system said:</p>
  
  <pre><code>logger.info('room %d created' % room._id)
  exceptions.TypeError: %d format: a number is required, not NoneType
  </code></pre>
  
  <p>Why is that happen?</p>