MCPcopy Index your code
hub / github.com/tortoise/tortoise-orm / create_connection

Method create_connection

tortoise/backends/sqlite/client.py:81–94  ·  view source on GitHub ↗
(self, with_db: bool)

Source from the content-addressed store, hash-verified

79 self._lock = asyncio.Lock()
80
81 async def create_connection(self, with_db: bool) -> None:
82 if not self._connection: # pragma: no branch
83 self._connection = await aiosqlite.connect(self.filename, isolation_level=None)
84 self._connection._conn.row_factory = sqlite3.Row
85 for pragma, val in self.pragmas.items():
86 cursor = await self._connection.execute(f"PRAGMA {pragma}={val}")
87 await cursor.close()
88 await self._post_connect()
89 self.log.debug(
90 "Created connection %s with params: filename=%s %s",
91 self._connection,
92 self.filename,
93 " ".join(f"{k}={v}" for k, v in self.pragmas.items()),
94 )
95
96 async def close(self) -> None:
97 if self._connection:

Callers 2

ensure_connectionMethod · 0.45
create_connectionMethod · 0.45

Calls 3

itemsMethod · 0.80
_post_connectMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected