Skip to content

connection

dandy.cache.sqlite.connection

SqliteConnection

Source code in dandy/cache/sqlite/connection.py
def __init__(self, db_name) -> None:
    self.db_path = Path(settings.CACHE_SQLITE_DATABASE_PATH, db_name)

db_path = Path(settings.CACHE_SQLITE_DATABASE_PATH, db_name) instance-attribute

__enter__

Source code in dandy/cache/sqlite/connection.py
def __enter__(self) -> sqlite3.Connection:
    self.connection = sqlite3.connect(self.db_path)
    return self.connection

__exit__

Source code in dandy/cache/sqlite/connection.py
def __exit__(self, exc_type, exc_value, traceback):
    if self.connection:
        self.connection.close()

delete_db_file

Source code in dandy/cache/sqlite/connection.py
def delete_db_file(self):
    os.remove(self.db_path)