2017-09-02 12 views
0

私はasyncioとaiopgを使用しており、INSERT実行後には私はlastrowidを取得できません。Python 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印刷と次の印刷すぎません。

SELECTを実行するとfetchone()とfetchall()と同じです。

答えて

0

cursor.lastrowidは通常のプロパティです。アクセスする前にawaitをドロップしてください。

関連する問題