Skip to content

Commit

Permalink
Fix: #7: return inserted object ID for UUID primary key
Browse files Browse the repository at this point in the history
  • Loading branch information
rudyryk committed Aug 26, 2015
1 parent a2d1985 commit e811af7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 6 additions & 2 deletions peewee_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,12 @@ def insert(query):
"with wrong query class %s" % str(query))

cursor = yield from cursor_with_query(query)
result = yield from query.database.last_insert_id_async(
cursor, query.model_class)

if query.is_insert_returning:
result = yield from cursor.fetchone()
else:
result = yield from query.database.last_insert_id_async(
cursor, query.model_class)

cursor.release()
if result:
Expand Down
1 change: 0 additions & 1 deletion tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ def test():
last_id = self.run_until_complete(test())
self.assertTrue(last_id is not None)

@unittest.skip("not implemented")
def test_insert_one_row_uuid_query(self):
@asyncio.coroutine
def test():
Expand Down

0 comments on commit e811af7

Please sign in to comment.