Skip to content

Commit dcb1761

Browse files
committed
Add missing license headers, auto call warm up
1 parent 156575a commit dcb1761

4 files changed

Lines changed: 13 additions & 5 deletions

File tree

integrations/snowflake/src/haystack_integrations/components/retrievers/snowflake/auth.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# SPDX-FileCopyrightText: 2025-present deepset GmbH <info@deepset.ai>
22
#
33
# SPDX-License-Identifier: Apache-2.0
4+
45
from pathlib import Path
56
from typing import Any, Literal, Optional
67
from urllib.parse import quote

integrations/snowflake/src/haystack_integrations/components/retrievers/snowflake/snowflake_table_retriever.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5-
from typing import Any, Literal, Optional
5+
from typing import Any, Literal, Optional, Union
66
from urllib.parse import quote_plus
77

88
import polars as pl
@@ -400,7 +400,7 @@ def _execute_query_with_connector(self, query: str) -> Optional[pl.DataFrame]:
400400
return None
401401

402402
@staticmethod
403-
def _empty_response() -> dict[str, Any]:
403+
def _empty_response() -> dict[str, Union[DataFrame, str]]:
404404
"""Returns a standardized empty response.
405405
406406
:returns:
@@ -411,7 +411,7 @@ def _empty_response() -> dict[str, Any]:
411411
return {"dataframe": DataFrame(), "table": ""}
412412

413413
@component.output_types(dataframe=DataFrame, table=str)
414-
def run(self, query: str, return_markdown: Optional[bool] = None) -> dict[str, Any]:
414+
def run(self, query: str, return_markdown: Optional[bool] = None) -> dict[str, Union[DataFrame, str]]:
415415
"""
416416
Executes a SQL query against a Snowflake database using ADBC and Polars.
417417
@@ -423,8 +423,7 @@ def run(self, query: str, return_markdown: Optional[bool] = None) -> dict[str, A
423423
- `"table"`: A Markdown-formatted string representation of the DataFrame.
424424
"""
425425
if not self._warmed_up:
426-
msg = "SnowflakeTableRetriever not warmed up. Please call `warm_up()` before running queries."
427-
raise RuntimeError(msg)
426+
self.warm_up()
428427

429428
# Validate SQL query
430429
if not query:

integrations/snowflake/tests/test_auth.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# SPDX-FileCopyrightText: 2025-present deepset GmbH <info@deepset.ai>
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
15
from pathlib import Path
26
from unittest.mock import Mock
37

integrations/snowflake/tests/test_snowflake_table_retriever.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# SPDX-FileCopyrightText: 2025-present deepset GmbH <info@deepset.ai>
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
15
import os
26
from pathlib import Path
37
from typing import Any, Optional

0 commit comments

Comments
 (0)