Skip to content

Commit aa04ab7

Browse files
fix(sqlalchemy): satisfy mypy union-attr check with runtime guard instead of assert
1 parent 6403d31 commit aa04ab7

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

integrations/sqlalchemy/src/haystack_integrations/components/retrievers/sqlalchemy/sqlalchemy_table_retriever.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ def run(self, query: str) -> dict[str, Any]:
168168
if not self._warmed_up:
169169
self.warm_up()
170170

171+
if self._engine is None: # pragma: no cover
172+
msg = "Engine is not initialized."
173+
raise RuntimeError(msg)
174+
171175
try:
172176
with self._engine.connect() as conn:
173177
result = conn.execute(text(query))

0 commit comments

Comments
 (0)