sqlalchemy-haystack 0.1.0__tar.gz → 1.0.0__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.
- sqlalchemy_haystack-1.0.0/CHANGELOG.md +9 -0
- sqlalchemy_haystack-1.0.0/PKG-INFO +39 -0
- sqlalchemy_haystack-1.0.0/README.md +13 -0
- {sqlalchemy_haystack-0.1.0 → sqlalchemy_haystack-1.0.0}/pyproject.toml +4 -4
- {sqlalchemy_haystack-0.1.0 → sqlalchemy_haystack-1.0.0}/tests/test_sqlalchemy_table_retriever.py +4 -2
- sqlalchemy_haystack-0.1.0/CHANGELOG.md +0 -7
- sqlalchemy_haystack-0.1.0/PKG-INFO +0 -106
- sqlalchemy_haystack-0.1.0/README.md +0 -79
- {sqlalchemy_haystack-0.1.0 → sqlalchemy_haystack-1.0.0}/.gitignore +0 -0
- {sqlalchemy_haystack-0.1.0 → sqlalchemy_haystack-1.0.0}/LICENSE.txt +0 -0
- {sqlalchemy_haystack-0.1.0 → sqlalchemy_haystack-1.0.0}/pydoc/config_docusaurus.yml +0 -0
- {sqlalchemy_haystack-0.1.0 → sqlalchemy_haystack-1.0.0}/src/haystack_integrations/components/retrievers/py.typed +0 -0
- {sqlalchemy_haystack-0.1.0 → sqlalchemy_haystack-1.0.0}/src/haystack_integrations/components/retrievers/sqlalchemy/__init__.py +0 -0
- {sqlalchemy_haystack-0.1.0 → sqlalchemy_haystack-1.0.0}/src/haystack_integrations/components/retrievers/sqlalchemy/sqlalchemy_table_retriever.py +0 -0
- {sqlalchemy_haystack-0.1.0 → sqlalchemy_haystack-1.0.0}/tests/__init__.py +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: sqlalchemy-haystack
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A SQLAlchemy integration for the Haystack framework.
|
|
5
|
+
Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/sqlalchemy#readme
|
|
6
|
+
Project-URL: Issues, https://github.com/deepset-ai/haystack-core-integrations/issues
|
|
7
|
+
Project-URL: Source, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/sqlalchemy
|
|
8
|
+
Author-email: deepset GmbH <info@deepset.ai>
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE.txt
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
|
+
Classifier: Programming Language :: Python
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
19
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
20
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
21
|
+
Requires-Python: >=3.11
|
|
22
|
+
Requires-Dist: haystack-ai>=2.22.0
|
|
23
|
+
Requires-Dist: pandas>=3.0.0
|
|
24
|
+
Requires-Dist: sqlalchemy>=2.0.36
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
# sqlalchemy-haystack
|
|
28
|
+
|
|
29
|
+
[](https://pypi.org/project/sqlalchemy-haystack)
|
|
30
|
+
[](https://pypi.org/project/sqlalchemy-haystack)
|
|
31
|
+
|
|
32
|
+
- [Integration page](https://haystack.deepset.ai/integrations/sqlalchemy)
|
|
33
|
+
- [Changelog](https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/sqlalchemy/CHANGELOG.md)
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Contributing
|
|
38
|
+
|
|
39
|
+
Refer to the general [Contribution Guidelines](https://github.com/deepset-ai/haystack-core-integrations/blob/main/CONTRIBUTING.md).
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# sqlalchemy-haystack
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/sqlalchemy-haystack)
|
|
4
|
+
[](https://pypi.org/project/sqlalchemy-haystack)
|
|
5
|
+
|
|
6
|
+
- [Integration page](https://haystack.deepset.ai/integrations/sqlalchemy)
|
|
7
|
+
- [Changelog](https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/sqlalchemy/CHANGELOG.md)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Contributing
|
|
12
|
+
|
|
13
|
+
Refer to the general [Contribution Guidelines](https://github.com/deepset-ai/haystack-core-integrations/blob/main/CONTRIBUTING.md).
|
|
@@ -7,7 +7,7 @@ name = "sqlalchemy-haystack"
|
|
|
7
7
|
dynamic = ["version"]
|
|
8
8
|
description = 'A SQLAlchemy integration for the Haystack framework.'
|
|
9
9
|
readme = "README.md"
|
|
10
|
-
requires-python = ">=3.
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
11
|
license = "Apache-2.0"
|
|
12
12
|
keywords = []
|
|
13
13
|
authors = [{ name = "deepset GmbH", email = "info@deepset.ai" }]
|
|
@@ -15,19 +15,18 @@ classifiers = [
|
|
|
15
15
|
"License :: OSI Approved :: Apache Software License",
|
|
16
16
|
"Development Status :: 4 - Beta",
|
|
17
17
|
"Programming Language :: Python",
|
|
18
|
-
"Programming Language :: Python :: 3.10",
|
|
19
18
|
"Programming Language :: Python :: 3.11",
|
|
20
19
|
"Programming Language :: Python :: 3.12",
|
|
21
20
|
"Programming Language :: Python :: 3.13",
|
|
22
21
|
"Programming Language :: Python :: 3.14",
|
|
22
|
+
"Programming Language :: Python :: 3.15",
|
|
23
23
|
"Programming Language :: Python :: Implementation :: CPython",
|
|
24
24
|
"Programming Language :: Python :: Implementation :: PyPy",
|
|
25
25
|
]
|
|
26
26
|
dependencies = [
|
|
27
27
|
"haystack-ai>=2.22.0",
|
|
28
28
|
"sqlalchemy>=2.0.36",
|
|
29
|
-
"pandas>=
|
|
30
|
-
"pandas>=3.0.0; python_version >= '3.11'",
|
|
29
|
+
"pandas>=3.0.0",
|
|
31
30
|
]
|
|
32
31
|
|
|
33
32
|
[project.urls]
|
|
@@ -137,6 +136,7 @@ ignore = [
|
|
|
137
136
|
"PLR0912",
|
|
138
137
|
"PLR0913",
|
|
139
138
|
"PLR0915",
|
|
139
|
+
"PLR0917",
|
|
140
140
|
# Ignore SQL injection warning (user-provided queries are expected)
|
|
141
141
|
"S608",
|
|
142
142
|
# Unused method argument
|
{sqlalchemy_haystack-0.1.0 → sqlalchemy_haystack-1.0.0}/tests/test_sqlalchemy_table_retriever.py
RENAMED
|
@@ -84,8 +84,10 @@ class TestSQLAlchemyTableRetrieverRun:
|
|
|
84
84
|
@pytest.fixture()
|
|
85
85
|
def retriever_with_data(self):
|
|
86
86
|
init_sql = [
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
(
|
|
88
|
+
"CREATE TABLE employees (id INTEGER PRIMARY KEY, name TEXT NOT NULL,"
|
|
89
|
+
" department TEXT NOT NULL, salary INTEGER NOT NULL)"
|
|
90
|
+
),
|
|
89
91
|
"INSERT INTO employees VALUES (1, 'Alice', 'Engineering', 95000)",
|
|
90
92
|
"INSERT INTO employees VALUES (2, 'Bob', 'Marketing', 72000)",
|
|
91
93
|
"INSERT INTO employees VALUES (3, 'Carol', 'Engineering', 88000)",
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: sqlalchemy-haystack
|
|
3
|
-
Version: 0.1.0
|
|
4
|
-
Summary: A SQLAlchemy integration for the Haystack framework.
|
|
5
|
-
Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/sqlalchemy#readme
|
|
6
|
-
Project-URL: Issues, https://github.com/deepset-ai/haystack-core-integrations/issues
|
|
7
|
-
Project-URL: Source, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/sqlalchemy
|
|
8
|
-
Author-email: deepset GmbH <info@deepset.ai>
|
|
9
|
-
License-Expression: Apache-2.0
|
|
10
|
-
License-File: LICENSE.txt
|
|
11
|
-
Classifier: Development Status :: 4 - Beta
|
|
12
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
|
-
Classifier: Programming Language :: Python
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
-
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
20
|
-
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
21
|
-
Requires-Python: >=3.10
|
|
22
|
-
Requires-Dist: haystack-ai>=2.22.0
|
|
23
|
-
Requires-Dist: pandas>=2.2.3; python_version < '3.11'
|
|
24
|
-
Requires-Dist: pandas>=3.0.0; python_version >= '3.11'
|
|
25
|
-
Requires-Dist: sqlalchemy>=2.0.36
|
|
26
|
-
Description-Content-Type: text/markdown
|
|
27
|
-
|
|
28
|
-
# sqlalchemy-haystack
|
|
29
|
-
|
|
30
|
-
[](https://pypi.org/project/sqlalchemy-haystack)
|
|
31
|
-
[](https://pypi.org/project/sqlalchemy-haystack)
|
|
32
|
-
|
|
33
|
-
- [Changelog](https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/sqlalchemy/CHANGELOG.md)
|
|
34
|
-
|
|
35
|
-
---
|
|
36
|
-
|
|
37
|
-
A Haystack integration for querying SQL databases via [SQLAlchemy](https://www.sqlalchemy.org/).
|
|
38
|
-
Provides a `SQLAlchemyTableRetriever` component that connects to any SQLAlchemy-supported database,
|
|
39
|
-
executes a SQL query, and returns results as a Pandas DataFrame and an optional Markdown table.
|
|
40
|
-
|
|
41
|
-
## Installation
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
pip install sqlalchemy-haystack
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
You also need to install the appropriate database driver for your backend:
|
|
48
|
-
|
|
49
|
-
| Backend | Driver package |
|
|
50
|
-
|---------|---------------|
|
|
51
|
-
| PostgreSQL | `psycopg2-binary` or `psycopg[binary]` |
|
|
52
|
-
| MySQL / MariaDB | `pymysql` or `mysqlclient` |
|
|
53
|
-
| SQLite | built-in (no extra package needed) |
|
|
54
|
-
| MSSQL | `pyodbc` |
|
|
55
|
-
| Oracle | `cx_oracle` or `oracledb` |
|
|
56
|
-
|
|
57
|
-
## Usage
|
|
58
|
-
|
|
59
|
-
```python
|
|
60
|
-
from haystack_integrations.components.retrievers.sqlalchemy import SQLAlchemyTableRetriever
|
|
61
|
-
|
|
62
|
-
# SQLite in-memory example (no driver needed)
|
|
63
|
-
retriever = SQLAlchemyTableRetriever(
|
|
64
|
-
drivername="sqlite",
|
|
65
|
-
database=":memory:",
|
|
66
|
-
init_script=[
|
|
67
|
-
"CREATE TABLE products (id INTEGER, name TEXT, price REAL)",
|
|
68
|
-
"INSERT INTO products VALUES (1, 'Widget', 9.99)",
|
|
69
|
-
"INSERT INTO products VALUES (2, 'Gadget', 19.99)",
|
|
70
|
-
],
|
|
71
|
-
)
|
|
72
|
-
retriever.warm_up()
|
|
73
|
-
|
|
74
|
-
result = retriever.run(query="SELECT * FROM products WHERE price < 15")
|
|
75
|
-
print(result["dataframe"])
|
|
76
|
-
print(result["table"])
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
For PostgreSQL:
|
|
80
|
-
|
|
81
|
-
```python
|
|
82
|
-
from haystack.utils import Secret
|
|
83
|
-
|
|
84
|
-
retriever = SQLAlchemyTableRetriever(
|
|
85
|
-
drivername="postgresql+psycopg2",
|
|
86
|
-
host="localhost",
|
|
87
|
-
port=5432,
|
|
88
|
-
database="mydb",
|
|
89
|
-
username="myuser",
|
|
90
|
-
password=Secret.from_env_var("DB_PASSWORD"),
|
|
91
|
-
)
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
## Security
|
|
95
|
-
|
|
96
|
-
This component executes raw SQL queries passed at runtime. Keep the following in mind:
|
|
97
|
-
|
|
98
|
-
- **Never pass unsanitised user input** directly as a query — this exposes you to SQL injection.
|
|
99
|
-
- **Use a read-only database user.** This is the most effective mitigation. Even if a malicious
|
|
100
|
-
query is executed, a read-only user cannot modify or delete data.
|
|
101
|
-
- **Restrict database permissions** to the minimum required — specific tables and schemas only,
|
|
102
|
-
no DDL privileges (no `CREATE`, `DROP`, `ALTER`).
|
|
103
|
-
|
|
104
|
-
## Contributing
|
|
105
|
-
|
|
106
|
-
Refer to the general [Contribution Guidelines](https://github.com/deepset-ai/haystack-core-integrations/blob/main/CONTRIBUTING.md).
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
# sqlalchemy-haystack
|
|
2
|
-
|
|
3
|
-
[](https://pypi.org/project/sqlalchemy-haystack)
|
|
4
|
-
[](https://pypi.org/project/sqlalchemy-haystack)
|
|
5
|
-
|
|
6
|
-
- [Changelog](https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/sqlalchemy/CHANGELOG.md)
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
A Haystack integration for querying SQL databases via [SQLAlchemy](https://www.sqlalchemy.org/).
|
|
11
|
-
Provides a `SQLAlchemyTableRetriever` component that connects to any SQLAlchemy-supported database,
|
|
12
|
-
executes a SQL query, and returns results as a Pandas DataFrame and an optional Markdown table.
|
|
13
|
-
|
|
14
|
-
## Installation
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
pip install sqlalchemy-haystack
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
You also need to install the appropriate database driver for your backend:
|
|
21
|
-
|
|
22
|
-
| Backend | Driver package |
|
|
23
|
-
|---------|---------------|
|
|
24
|
-
| PostgreSQL | `psycopg2-binary` or `psycopg[binary]` |
|
|
25
|
-
| MySQL / MariaDB | `pymysql` or `mysqlclient` |
|
|
26
|
-
| SQLite | built-in (no extra package needed) |
|
|
27
|
-
| MSSQL | `pyodbc` |
|
|
28
|
-
| Oracle | `cx_oracle` or `oracledb` |
|
|
29
|
-
|
|
30
|
-
## Usage
|
|
31
|
-
|
|
32
|
-
```python
|
|
33
|
-
from haystack_integrations.components.retrievers.sqlalchemy import SQLAlchemyTableRetriever
|
|
34
|
-
|
|
35
|
-
# SQLite in-memory example (no driver needed)
|
|
36
|
-
retriever = SQLAlchemyTableRetriever(
|
|
37
|
-
drivername="sqlite",
|
|
38
|
-
database=":memory:",
|
|
39
|
-
init_script=[
|
|
40
|
-
"CREATE TABLE products (id INTEGER, name TEXT, price REAL)",
|
|
41
|
-
"INSERT INTO products VALUES (1, 'Widget', 9.99)",
|
|
42
|
-
"INSERT INTO products VALUES (2, 'Gadget', 19.99)",
|
|
43
|
-
],
|
|
44
|
-
)
|
|
45
|
-
retriever.warm_up()
|
|
46
|
-
|
|
47
|
-
result = retriever.run(query="SELECT * FROM products WHERE price < 15")
|
|
48
|
-
print(result["dataframe"])
|
|
49
|
-
print(result["table"])
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
For PostgreSQL:
|
|
53
|
-
|
|
54
|
-
```python
|
|
55
|
-
from haystack.utils import Secret
|
|
56
|
-
|
|
57
|
-
retriever = SQLAlchemyTableRetriever(
|
|
58
|
-
drivername="postgresql+psycopg2",
|
|
59
|
-
host="localhost",
|
|
60
|
-
port=5432,
|
|
61
|
-
database="mydb",
|
|
62
|
-
username="myuser",
|
|
63
|
-
password=Secret.from_env_var("DB_PASSWORD"),
|
|
64
|
-
)
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
## Security
|
|
68
|
-
|
|
69
|
-
This component executes raw SQL queries passed at runtime. Keep the following in mind:
|
|
70
|
-
|
|
71
|
-
- **Never pass unsanitised user input** directly as a query — this exposes you to SQL injection.
|
|
72
|
-
- **Use a read-only database user.** This is the most effective mitigation. Even if a malicious
|
|
73
|
-
query is executed, a read-only user cannot modify or delete data.
|
|
74
|
-
- **Restrict database permissions** to the minimum required — specific tables and schemas only,
|
|
75
|
-
no DDL privileges (no `CREATE`, `DROP`, `ALTER`).
|
|
76
|
-
|
|
77
|
-
## Contributing
|
|
78
|
-
|
|
79
|
-
Refer to the general [Contribution Guidelines](https://github.com/deepset-ai/haystack-core-integrations/blob/main/CONTRIBUTING.md).
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|