(self, sql: str, data: list | dict = None)
| 144 | return data |
| 145 | |
| 146 | async def execute(self, sql: str, data: list | dict = None): |
| 147 | # logger.info("go into OracleDB execute method") |
| 148 | try: |
| 149 | async with self.pool.acquire() as connection: |
| 150 | connection.inputtypehandler = self.input_type_handler |
| 151 | connection.outputtypehandler = self.output_type_handler |
| 152 | with connection.cursor() as cursor: |
| 153 | if data is None: |
| 154 | await cursor.execute(sql) |
| 155 | else: |
| 156 | # print(data) |
| 157 | # print(sql) |
| 158 | await cursor.execute(sql, data) |
| 159 | await connection.commit() |
| 160 | except Exception as e: |
| 161 | logger.error(f"Oracle database error: {e}") |
| 162 | print(sql) |
| 163 | print(data) |
| 164 | raise |
| 165 | |
| 166 | |
| 167 | @dataclass |
no outgoing calls
no test coverage detected