Python aiopg lastrowid



我正在使用asyncio和aiopg,插入执行后,我无法获得lastrowid。

我的代码:

 async with aiopg.create_pool(self.connect, loop=self._loop) as pool:
      async with pool.acquire() as connect:
           async with connect.cursor() as cursor:
                await cursor.execute("INSERT INTO users(user_firstname,user_lastname) VALUES('Johan', 'Smith')")
                print(await cursor.lastrowid)
                print(' - - - ')
                pass
           pass
      pass
 pass

执行工作,但Lastrowid也没有打印,也没有打印。

与fetchone()和fetchall()相同,如果我执行选择。

cursor.lastrowid是常规属性,在访问它之前将 await删除。

最新更新