async def init_orm() -> None: # pylint: disable=W0612 await Tortoise.init(config=config, config_file=config_file, db_url=db_url, modules=modules) logger.info("Tortoise-ORM started, %s, %s", Tortoise._connections, Tortoise.apps) if generate_schemas: logger.info("Tortoise-ORM generating schema") await Tortoise.generate_schemas()
async def init_orm(app): # pylint: disable=W0612 await Tortoise.init(config=config, config_file=config_file, db_url=db_url, modules=modules) logger.info( f"Tortoise-ORM started, {connections._get_storage()}, {Tortoise.apps}" ) if generate_schemas: logger.info("Tortoise-ORM generating schema") await Tortoise.generate_schemas()
async def close_connections(cls) -> None: """ Close all connections cleanly. It is required for this to be called on exit, else your event loop may never complete as it is waiting for the connections to die. .. warning:: This is deprecated and will be removed in a future release. Please use :meth:`connections.close_all<tortoise.connection.ConnectionHandler.close_all>` instead. """ await connections.close_all() logger.info("Tortoise-ORM shutdown")
async def close_connections(cls) -> None: """ Close all connections cleanly. It is required for this to be called on exit, else your event loop may never complete as it is waiting for the connections to die. """ tasks = [] for connection in cls._connections.values(): tasks.append(connection.close()) await asyncio.gather(*tasks) cls._connections = {} logger.info("Tortoise-ORM shutdown")
async def close_orm() -> None: # pylint: disable=W0612 await Tortoise.close_connections() logger.info("Tortoise-ORM shutdown")
async def close_orm(app): # pylint: disable=W0612 await connections.close_all() logger.info("Tortoise-ORM shutdown")