Skip to content

Commit

Permalink
init connection
Browse files Browse the repository at this point in the history
  • Loading branch information
spicy-sauce committed Aug 6, 2024
1 parent 0780261 commit 33e3aab
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/src/datayoga_core/blocks/relational/write/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def init(self, context: Optional[Context] = None):

self.context = context
self.engine = None
self.connection = None
self.setup_engine()

def setup_engine(self):
Expand Down Expand Up @@ -228,7 +229,7 @@ def _is_connection_valid(self) -> bool:

def _handle_connection_error(self, error: Exception):
"""Handles connection errors by disposing the engine if necessary and raising ConnectionError."""
if not self._is_connection_valid():
if self.connection is not None and not self._is_connection_valid():
self.dispose_engine()
raise ConnectionError(error)
else:
Expand Down

0 comments on commit 33e3aab

Please sign in to comment.