{"action":"closed","issue":{"url":"https://api.github.com/repos/rbarrois/factory_boy/issues/153","labels_url":"https://api.github.com/repos/rbarrois/factory_boy/issues/153/labels{/name}","comments_url":"https://api.github.com/repos/rbarrois/factory_boy/issues/153/comments","events_url":"https://api.github.com/repos/rbarrois/factory_boy/issues/153/events","html_url":"https://github.com/rbarrois/factory_boy/issues/153","id":40103826,"number":153,"title":"Factories doesn't seem to work if a session hasn't been used yet.","user":{"login":"jpanganiban","id":427738,"avatar_url":"https://avatars.githubusercontent.com/u/427738?v=3","gravatar_id":"","url":"https://api.github.com/users/jpanganiban","html_url":"https://github.com/jpanganiban","followers_url":"https://api.github.com/users/jpanganiban/followers","following_url":"https://api.github.com/users/jpanganiban/following{/other_user}","gists_url":"https://api.github.com/users/jpanganiban/gists{/gist_id}","starred_url":"https://api.github.com/users/jpanganiban/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpanganiban/subscriptions","organizations_url":"https://api.github.com/users/jpanganiban/orgs","repos_url":"https://api.github.com/users/jpanganiban/repos","events_url":"https://api.github.com/users/jpanganiban/events{/privacy}","received_events_url":"https://api.github.com/users/jpanganiban/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rbarrois/factory_boy/labels/BadMagic","name":"BadMagic","color":"d7e102"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2014-08-12T21:59:57Z","updated_at":"2015-03-26T21:56:16Z","closed_at":"2015-03-26T21:56:16Z","body":"I'm working with SQLAlchemy (with a scoped_session). Here's what I'm getting:\r\n\r\n```\r\nclass TestCase(unittest.TestCase):\r\n\r\n    def setUp(self):\r\n        self.obj = ObjectFactory()\r\n        print self.obj.id  # None\r\n\r\n    def test_scenario(self):\r\n        print self.obj.id  # None; Weird.\r\n        session.query(Object).first()\r\n        print ObjectFactory().id  # 1; Weird.\r\n```\r\n\r\nEDIT:\r\n`setUp` doesn't seem to be the causing issue. It seems that `_setup_next_sequency()` doesn't get any primary keys to use if the session hasn't been used yet."}}