diff --git a/asyncdb/drivers/pg.py b/asyncdb/drivers/pg.py index c05eac16..798ddc71 100644 --- a/asyncdb/drivers/pg.py +++ b/asyncdb/drivers/pg.py @@ -1011,6 +1011,17 @@ async def copy_from_table(self, table="", schema="public", output=None, file_typ output=output, ) return result + except ( + QueryCanceledError, + StatementError, + UniqueViolationError, + ForeignKeyViolationError, + NotNullViolationError + ) as err: + self._logger.warning( + f"AsyncPg Copy From Table: {err}" + ) + raise except UndefinedTableError as ex: raise StatementError(f"Error on Copy, Table {table }doesn't exists: {ex}") from ex except (InvalidSQLStatementNameError, PostgresSyntaxError, UndefinedColumnError) as ex: @@ -1038,10 +1049,23 @@ async def copy_to_table(self, table="", schema="public", source=None, file_type= source=source, ) return result + except ( + QueryCanceledError, + StatementError, + UniqueViolationError, + ForeignKeyViolationError, + NotNullViolationError + ) as err: + self._logger.warning( + f"AsyncPg Copy To Table: {err}" + ) + raise except UndefinedTableError as ex: - raise StatementError(f"Error on Copy to Table {table }doesn't exists: {ex}") from ex + raise StatementError( + f"Error on Copy to Table {table } doesn't exists: {ex}") from ex except (InvalidSQLStatementNameError, PostgresSyntaxError, UndefinedColumnError) as ex: - raise StatementError(f"Error on Copy, Invalid Statement Error: {ex}") from ex + raise StatementError( + f"Error on Copy, Invalid Statement Error: {ex}") from ex except Exception as ex: raise DriverError(f"Error on Copy to Table {ex}") from ex @@ -1061,12 +1085,21 @@ async def copy_into_table(self, table="", schema="public", source=None, columns= table_name=table, schema_name=schema, columns=columns, records=source ) return result + except ( + QueryCanceledError, + StatementError, + UniqueViolationError, + ForeignKeyViolationError, + NotNullViolationError + ) as err: + self._logger.warning( + f"AsyncPg Copy Into Table: {err}" + ) + raise except UndefinedTableError as ex: - raise StatementError(f"Error on Copy to Table {table }doesn't exists: {ex}") from ex + raise StatementError(f"Error on Copy to Table {table } doesn't exists: {ex}") from ex except (InvalidSQLStatementNameError, PostgresSyntaxError, UndefinedColumnError) as ex: raise StatementError(f"Error on Copy, Invalid Statement Error: {ex}") from ex - except UniqueViolationError as ex: - raise StatementError(f"Error on Copy, Constraint Violated: {ex}") from ex except InterfaceError as ex: raise DriverError(f"Error on Copy into Table Function: {ex}") from ex except (RuntimeError, PostgresError) as ex: diff --git a/asyncdb/version.py b/asyncdb/version.py index 786a3761..a30a0164 100644 --- a/asyncdb/version.py +++ b/asyncdb/version.py @@ -3,7 +3,7 @@ __title__ = "asyncdb" __description__ = "Library for Asynchronous data source connections \ Collection of asyncio drivers." -__version__ = "2.9.4" +__version__ = "2.9.5" __author__ = "Jesus Lara" __author_email__ = "jesuslarag@gmail.com" __license__ = "BSD"