async def init(loop): pool = await orm.create_pool(loop, user='root', password='password', db='test') try: u = await user.find(100) print(u) u2 = user(id=100, name='alice') await u2.update() await u2.remove() await u2.save() except BaseException as e: logging.error('%s',e) else: logging.info('run ok') pool.close() await pool.wait_closed() loop = asyncio.get_event_loop() loop.run_until_complete(init(loop=loop)) loop.close()
Sign in to make a reply
新故式每天去实验室