From 046044f9de808eff215681a3c8fd0009efe9fbfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez=20Mondrag=C3=B3n?= Date: Tue, 8 Aug 2023 14:51:56 -0600 Subject: [PATCH] Address issues --- singer_sdk/connectors/sql.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/singer_sdk/connectors/sql.py b/singer_sdk/connectors/sql.py index fd1368565..4eec00599 100644 --- a/singer_sdk/connectors/sql.py +++ b/singer_sdk/connectors/sql.py @@ -23,6 +23,7 @@ if t.TYPE_CHECKING: from sqlalchemy.engine.reflection import Inspector + from sqlalchemy.sql.elements import TextClause class SQLConnector: @@ -746,7 +747,7 @@ def prepare_schema(self, schema_name: str) -> None: @staticmethod def get_truncate_table_ddl( table_name: str, - ) -> tuple[text, dict]: + ) -> tuple[TextClause, dict]: """Get the truncate table SQL statement. Override this if your database uses a different syntax for truncating tables. @@ -778,9 +779,8 @@ def truncate_table(self, full_table_name: str) -> None: truncate_table_ddl, kwargs = self.get_truncate_table_ddl( table_name=full_table_name, ) - with self._connect() as conn: + with self._connect() as conn, conn.begin(): conn.execute(truncate_table_ddl, **kwargs) - conn.commit() def prepare_table( self,