File size: 678 Bytes
9002555
 
 
 
 
 
 
 
 
 
 
 
d57efd6
9002555
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import logging
from db.repository import Repository, get_db_conn

# Setup logging (configure as needed)
logging.basicConfig(level=logging.INFO)


class DeleteDatabase(Repository):
    async def delete_record(self, params):
        if "id" not in params:
            raise ValueError("The 'id' parameter is required.")
        query = """
            DELETE FROM metadata 
            WHERE id = :id
        """

        try:
            await self._exec(query, params)
            logging.info(f"Record with id {params['id']} deleted successfully.")
        except Exception as e:
            logging.error(f"Error deleting record with id {params['id']}: {e}")
            raise