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