Check if a table exists in the database
(self, db, table_name: str)
| 52 | yield db |
| 53 | |
| 54 | async def _table_exists(self, db, table_name: str) -> bool: |
| 55 | """Check if a table exists in the database""" |
| 56 | cursor = await db.execute( |
| 57 | "SELECT name FROM sqlite_master WHERE type='table' AND name=?", |
| 58 | (table_name,) |
| 59 | ) |
| 60 | result = await cursor.fetchone() |
| 61 | return result is not None |
| 62 | |
| 63 | async def _column_exists(self, db, table_name: str, column_name: str) -> bool: |
| 64 | """Check if a column exists in a table""" |
no outgoing calls
no test coverage detected