sqlalchemy-haystack 1.0.0__tar.gz → 1.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,25 @@
1
+ # Changelog
2
+
3
+ ## [integrations/sqlalchemy-v1.0.0] - 2026-10-16
4
+
5
+ ### 🐛 Bug Fixes
6
+
7
+ - Fix new issues raised by ruff 0.16.0 (#3670)
8
+
9
+ ### 🧪 Testing
10
+
11
+ - Test compatible integrations with Python 3.15; update pyproject (#4104)
12
+
13
+ ### 🧹 Chores
14
+
15
+ - Re-standardize READMEs (#3768)
16
+ - [**breaking**] Drop Python 3.10 support (#4105)
17
+
18
+
19
+ ## [integrations/sqlalchemy-v0.1.0] - 2026-04-15
20
+
21
+ ### 🚀 Features
22
+
23
+ - Adding an `SQLAlchemy` integration (#3098)
24
+
25
+ <!-- generated by git-cliff -->
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: sqlalchemy-haystack
3
- Version: 1.0.0
3
+ Version: 1.0.1
4
4
  Summary: A SQLAlchemy integration for the Haystack framework.
5
5
  Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/sqlalchemy#readme
6
6
  Project-URL: Issues, https://github.com/deepset-ai/haystack-core-integrations/issues
@@ -8,7 +8,7 @@ from haystack import component, default_from_dict, default_to_dict, logging
8
8
  from haystack.utils import Secret, deserialize_secrets_inplace
9
9
  from pandas import DataFrame
10
10
 
11
- from sqlalchemy import create_engine, text
11
+ from sqlalchemy import create_engine
12
12
  from sqlalchemy.engine import URL, Engine
13
13
  from sqlalchemy.exc import SQLAlchemyError
14
14
  from sqlalchemy.pool import StaticPool
@@ -18,6 +18,11 @@ logger = logging.getLogger(__name__)
18
18
  MAX_SYS_ROWS = 10_000
19
19
 
20
20
 
21
+ # Run SQL strings as written: `text()` would treat ":name" (even inside string literals) as a bind parameter.
22
+ # `no_parameters` stops drivers such as psycopg2 from treating "%" as a parameter marker.
23
+ _RAW_SQL_OPTIONS = {"no_parameters": True}
24
+
25
+
21
26
  @component
22
27
  class SQLAlchemyTableRetriever:
23
28
  """
@@ -104,7 +109,7 @@ class SQLAlchemyTableRetriever:
104
109
  for stmt in self.init_script:
105
110
  stripped = stmt.strip()
106
111
  if stripped:
107
- conn.execute(text(stripped))
112
+ conn.exec_driver_sql(stripped, execution_options=_RAW_SQL_OPTIONS)
108
113
  conn.commit()
109
114
 
110
115
  self._warmed_up = True
@@ -174,7 +179,7 @@ class SQLAlchemyTableRetriever:
174
179
 
175
180
  try:
176
181
  with self._engine.connect() as conn:
177
- result = conn.execute(text(query))
182
+ result = conn.exec_driver_sql(query, execution_options=_RAW_SQL_OPTIONS)
178
183
  rows = result.fetchmany(MAX_SYS_ROWS)
179
184
  columns = list(result.keys())
180
185
  df = DataFrame(rows, columns=columns)
@@ -173,3 +173,19 @@ class TestSQLAlchemyTableRetrieverRun:
173
173
  result = retriever.run(query="SELECT 1 AS x")
174
174
  assert retriever._warmed_up
175
175
  assert not result["dataframe"].empty
176
+
177
+ def test_colons_in_string_literals_are_not_bind_parameters(self):
178
+ retriever = SQLAlchemyTableRetriever(
179
+ drivername="sqlite",
180
+ database=":memory:",
181
+ init_script=[
182
+ "CREATE TABLE notes (id INTEGER, body TEXT)",
183
+ "INSERT INTO notes VALUES (1, 'see :ref'), (2, '{\"k\":1}')",
184
+ ],
185
+ )
186
+ retriever.warm_up()
187
+
188
+ result = retriever.run(query="SELECT id FROM notes WHERE body = 'see :ref' OR body = '{\"k\":1}' ORDER BY id")
189
+
190
+ assert result["error"] == ""
191
+ assert result["dataframe"]["id"].tolist() == [1, 2]
@@ -1,9 +0,0 @@
1
- # Changelog
2
-
3
- ## [integrations/sqlalchemy-v0.1.0] - 2026-04-15
4
-
5
- ### 🚀 Features
6
-
7
- - Adding an `SQLAlchemy` integration (#3098)
8
-
9
- <!-- generated by git-cliff -->