diff --git a/fixture/loadable/sqlalchemy_loadable.py b/fixture/loadable/sqlalchemy_loadable.py index 3e14f7e..62872bb 100644 --- a/fixture/loadable/sqlalchemy_loadable.py +++ b/fixture/loadable/sqlalchemy_loadable.py @@ -324,7 +324,13 @@ def save(self, row, column_vals): c = self.conn.execute(stmt, params) else: c = stmt.execute(params) - primary_key = c.last_inserted_ids() + + # In SQLAlchemy 0.8 this changed to a property with another name + if hasattr(c, "primary_key"): + primary_key = c.primary_key + else: + primary_key = c.last_inserted_ids() + if primary_key is None: raise NotImplementedError( "what can we do with a None primary key?")