Skip to content

Commit

Permalink
test: Fix FATAL: sorry, too many clients already
Browse files Browse the repository at this point in the history
Within `PostgresConnector(SQLConnector)`, this aims to dispose the
underlying SQLAlchemy engine object when being torn down.
  • Loading branch information
amotl committed Dec 19, 2023
1 parent a9d1796 commit 2eede7e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions target_postgres/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,13 @@ def column_exists( # type: ignore[override]
schema_name=schema_name, table_name=table_name, connection=connection
)

def __del__(self):
"""
Dispose underlying SQLAlchemy engine object.
"""
if self._cached_engine is not None:
self._cached_engine.dispose()


class NOTYPE(TypeDecorator):
"""Type to use when none is provided in the schema."""
Expand Down

0 comments on commit 2eede7e

Please sign in to comment.