Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions python/sedonadb/python/sedonadb/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,17 @@ class DBEngine:
of that name.
"""

def close(self):
"""Close the connection - base implementation does nothing"""
pass

def __enter__(self):
return self

def __exit__(self, exc_type, exc_val, exc_tb):
self.close()
return False

@classmethod
def name(cls) -> str:
"""This engine's name
Expand Down Expand Up @@ -399,6 +410,11 @@ def __init__(self, uri=None):
uri = "postgresql://localhost:5432/postgres?user=postgres&password=password"
self.con = adbc_driver_postgresql.dbapi.connect(uri)

def close(self):
"""Close the connection"""
if self.con:
self.con.close()

@classmethod
def name(cls):
return "postgis"
Expand Down
Loading