sqlalchemy-haystack 1.0.0__py3-none-any.whl → 1.0.1__py3-none-any.whl

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.
@@ -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)
@@ -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
@@ -0,0 +1,7 @@
1
+ haystack_integrations/components/retrievers/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ haystack_integrations/components/retrievers/sqlalchemy/__init__.py,sha256=liy4ghmFWcEaO3YrOddymf2JAO6mNcFR0mEExCAsMoA,216
3
+ haystack_integrations/components/retrievers/sqlalchemy/sqlalchemy_table_retriever.py,sha256=ZXCvJIPmtWumSKe-Qsr4PrGDONWo2q_Mzi6tpeK_DfA,6905
4
+ sqlalchemy_haystack-1.0.1.dist-info/METADATA,sha256=BASysSbF5mOhKxquwCTo71UMglbKa2_EJKlSUX_CQ6E,1888
5
+ sqlalchemy_haystack-1.0.1.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
6
+ sqlalchemy_haystack-1.0.1.dist-info/licenses/LICENSE.txt,sha256=wgdPKd-oq38RN75QBLghmssq3kYvVatOsKNomySh3AY,11342
7
+ sqlalchemy_haystack-1.0.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.32.4
2
+ Generator: hatchling 1.33.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,7 +0,0 @@
1
- haystack_integrations/components/retrievers/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- haystack_integrations/components/retrievers/sqlalchemy/__init__.py,sha256=liy4ghmFWcEaO3YrOddymf2JAO6mNcFR0mEExCAsMoA,216
3
- haystack_integrations/components/retrievers/sqlalchemy/sqlalchemy_table_retriever.py,sha256=ZKz2NkZ1XTi4ZhwoiDG0tUorviA8p6_3LYS-zOW9F2M,6590
4
- sqlalchemy_haystack-1.0.0.dist-info/METADATA,sha256=E_S6iS4JD4_Te_6H6ltTZOxgZdmKvjQNGX26gNCJBUo,1888
5
- sqlalchemy_haystack-1.0.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
6
- sqlalchemy_haystack-1.0.0.dist-info/licenses/LICENSE.txt,sha256=wgdPKd-oq38RN75QBLghmssq3kYvVatOsKNomySh3AY,11342
7
- sqlalchemy_haystack-1.0.0.dist-info/RECORD,,