title: SQLAlchemy: 'NoneType' object has no attribute '_expire_attributes' on bulk_update_mappings
body: <p>I've been trying to get use of the SQLAlchemy ORM's <code>bulk_update_mappings</code> method, but I'm getting a most unhelpful error message:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/vagrant/strategies/tests/test_collectors.py", line 173, in test_collect__with_update
      provider.collect()
    File "/vagrant/strategies/models.py", line 46, in collect
      self.collector.update()
    File "/vagrant/strategies/database/collectors.py", line 60, in update
      db_session.bulk_save_objects(strategies)
    File "/usr/local/miniconda3/lib/python3.4/site-packages/sqlalchemy/orm/scoping.py", line 150, in do
      return getattr(self.registry(), name)(*args, **kwargs)
    File "/usr/local/miniconda3/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 2203, in bulk_save_objects
      return_defaults, update_changed_only)
    File "/usr/local/miniconda3/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 2340, in _bulk_save_mappings
      transaction.rollback(_capture_exception=True)
    File "/usr/local/miniconda3/lib/python3.4/site-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__
      compat.reraise(exc_type, exc_value, exc_tb)
    File "/usr/local/miniconda3/lib/python3.4/site-packages/sqlalchemy/util/compat.py", line 182, in reraise
      raise value
    File "/usr/local/miniconda3/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 2332, in _bulk_save_mappings
      isstates, update_changed_only)
    File "/usr/local/miniconda3/lib/python3.4/site-packages/sqlalchemy/orm/persistence.py", line 121, in _bulk_update
      bookkeeping=False)
    File "/usr/local/miniconda3/lib/python3.4/site-packages/sqlalchemy/orm/persistence.py", line 705, in _emit_update_statements
      value_params)
    File "/usr/local/miniconda3/lib/python3.4/site-packages/sqlalchemy/orm/persistence.py", line 998, in _postfetch
      state._expire_attributes(state.dict,
  AttributeError: 'NoneType' object has no attribute '_expire_attributes'
  </code></pre>
  
  <p>The same error also happens when I use <code>bulk_save_objects</code>, but oddly not on <code>bulk_insert_mappings</code>, which seems to be indicating that there is some issue with my updates, but the documentation is not very helpful. My guess is that it has something to do with relationships, but I've tried using both the full relationship objects and just their <code>id</code>s for update values, and no luck so far.</p>
  
  <p>Any ideas would be appreciated!</p>