Skip to content

Commit 7fc39e0

Browse files
committed
Revert "Add __exit__ methods to PandasSQL"
This reverts commit 374c5ac.
1 parent 374c5ac commit 7fc39e0

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

pandas/io/sql.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,8 +1455,7 @@ class PandasSQL(PandasObject, ABC):
14551455
def __enter__(self) -> Self:
14561456
return self
14571457

1458-
@abstractmethod
1459-
def __exit__(self, exc_type, exc_value, traceback) -> None:
1458+
def __exit__(self, *args) -> None:
14601459
pass
14611460

14621461
def read_table(
@@ -1648,7 +1647,7 @@ def __init__(
16481647
self.meta = MetaData(schema=schema)
16491648
self.returns_generator = False
16501649

1651-
def __exit__(self, exc_type, exc_value, traceback) -> None:
1650+
def __exit__(self, *args) -> None:
16521651
if not self.returns_generator:
16531652
self.exit_stack.close()
16541653

@@ -2127,9 +2126,6 @@ class ADBCDatabase(PandasSQL):
21272126
def __init__(self, con) -> None:
21282127
self.con = con
21292128

2130-
def __exit__(self, exc_type, exc_value, traceback) -> None:
2131-
self.con.close()
2132-
21332129
@contextmanager
21342130
def run_transaction(self):
21352131
with self.con.cursor() as cur:
@@ -2683,9 +2679,6 @@ class SQLiteDatabase(PandasSQL):
26832679
def __init__(self, con) -> None:
26842680
self.con = con
26852681

2686-
def __exit__(self, exc_type, exc_value, traceback) -> None:
2687-
self.con.close()
2688-
26892682
@contextmanager
26902683
def run_transaction(self):
26912684
cur = self.con.cursor()

0 commit comments

Comments
 (0)