dagster-qdrant 0.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.
- dagster_qdrant-0.0.1/PKG-INFO +73 -0
- dagster_qdrant-0.0.1/README.md +64 -0
- dagster_qdrant-0.0.1/dagster_qdrant/__init__.py +4 -0
- dagster_qdrant-0.0.1/dagster_qdrant/config.py +53 -0
- dagster_qdrant-0.0.1/dagster_qdrant/resource.py +28 -0
- dagster_qdrant-0.0.1/dagster_qdrant.egg-info/PKG-INFO +73 -0
- dagster_qdrant-0.0.1/dagster_qdrant.egg-info/SOURCES.txt +10 -0
- dagster_qdrant-0.0.1/dagster_qdrant.egg-info/dependency_links.txt +1 -0
- dagster_qdrant-0.0.1/dagster_qdrant.egg-info/requires.txt +2 -0
- dagster_qdrant-0.0.1/dagster_qdrant.egg-info/top_level.txt +1 -0
- dagster_qdrant-0.0.1/pyproject.toml +26 -0
- dagster_qdrant-0.0.1/setup.cfg +4 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: dagster-qdrant
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Dagster integration with Qdrant
|
|
5
|
+
Requires-Python: >=3.9
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: dagster>=1.8.0
|
|
8
|
+
Requires-Dist: qdrant-client>=1.13.2
|
|
9
|
+
|
|
10
|
+
# dagster-qdrant
|
|
11
|
+
|
|
12
|
+
A Dagster module that provides an integration with [Qdrant](https://qdrant.tech/).
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
The `dagster_qdrant` module is available as a PyPI package - install with your preferred python
|
|
17
|
+
environment manager (We recommend [uv](https://github.com/astral-sh/uv)).
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
source .venv/bin/activate
|
|
21
|
+
uv pip install dagster-qdrant
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Example Usage
|
|
25
|
+
|
|
26
|
+
You can get a free-forever cloud instance from [cloud.qdrant.io](http://cloud.qdrant.io).
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from dagster_qdrant import QdrantConfig, QdrantResource
|
|
30
|
+
|
|
31
|
+
import dagster as dg
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@dg.asset
|
|
35
|
+
def my_table(qdrant_resource: QdrantResource):
|
|
36
|
+
with qdrant_resource.get_client() as qdrant:
|
|
37
|
+
qdrant.add(
|
|
38
|
+
collection_name="test_collection",
|
|
39
|
+
documents=[
|
|
40
|
+
"This is a document about oranges",
|
|
41
|
+
"This is a document about pineapples",
|
|
42
|
+
"This is a document about strawberries",
|
|
43
|
+
"This is a document about cucumbers",
|
|
44
|
+
],
|
|
45
|
+
)
|
|
46
|
+
results = qdrant.query(
|
|
47
|
+
collection_name="test_collection", query_text="hawaii", limit=3
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
defs = dg.Definitions(
|
|
52
|
+
assets=[my_table],
|
|
53
|
+
resources={
|
|
54
|
+
"qdrant_resource": QdrantResource(
|
|
55
|
+
config=QdrantConfig(
|
|
56
|
+
host="xyz-example.eu-central.aws.cloud.qdrant.io",
|
|
57
|
+
api_key="<your-api-key>",
|
|
58
|
+
)
|
|
59
|
+
)
|
|
60
|
+
},
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Development
|
|
66
|
+
|
|
67
|
+
The `Makefile` provides the tools required to test and lint your local installation.
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
make test
|
|
71
|
+
make ruff
|
|
72
|
+
make check
|
|
73
|
+
```
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# dagster-qdrant
|
|
2
|
+
|
|
3
|
+
A Dagster module that provides an integration with [Qdrant](https://qdrant.tech/).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
The `dagster_qdrant` module is available as a PyPI package - install with your preferred python
|
|
8
|
+
environment manager (We recommend [uv](https://github.com/astral-sh/uv)).
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
source .venv/bin/activate
|
|
12
|
+
uv pip install dagster-qdrant
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Example Usage
|
|
16
|
+
|
|
17
|
+
You can get a free-forever cloud instance from [cloud.qdrant.io](http://cloud.qdrant.io).
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
from dagster_qdrant import QdrantConfig, QdrantResource
|
|
21
|
+
|
|
22
|
+
import dagster as dg
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@dg.asset
|
|
26
|
+
def my_table(qdrant_resource: QdrantResource):
|
|
27
|
+
with qdrant_resource.get_client() as qdrant:
|
|
28
|
+
qdrant.add(
|
|
29
|
+
collection_name="test_collection",
|
|
30
|
+
documents=[
|
|
31
|
+
"This is a document about oranges",
|
|
32
|
+
"This is a document about pineapples",
|
|
33
|
+
"This is a document about strawberries",
|
|
34
|
+
"This is a document about cucumbers",
|
|
35
|
+
],
|
|
36
|
+
)
|
|
37
|
+
results = qdrant.query(
|
|
38
|
+
collection_name="test_collection", query_text="hawaii", limit=3
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
defs = dg.Definitions(
|
|
43
|
+
assets=[my_table],
|
|
44
|
+
resources={
|
|
45
|
+
"qdrant_resource": QdrantResource(
|
|
46
|
+
config=QdrantConfig(
|
|
47
|
+
host="xyz-example.eu-central.aws.cloud.qdrant.io",
|
|
48
|
+
api_key="<your-api-key>",
|
|
49
|
+
)
|
|
50
|
+
)
|
|
51
|
+
},
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Development
|
|
57
|
+
|
|
58
|
+
The `Makefile` provides the tools required to test and lint your local installation.
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
make test
|
|
62
|
+
make ruff
|
|
63
|
+
make check
|
|
64
|
+
```
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from dagster import Config
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class QdrantConfig(Config):
|
|
7
|
+
"""Parameters to set up connection to a Qdrant service."""
|
|
8
|
+
|
|
9
|
+
location: Optional[str] = None
|
|
10
|
+
""" If `":memory:"` - use in-memory Qdrant instance.
|
|
11
|
+
If `str` - use it as a `url` parameter.
|
|
12
|
+
If `None` - use default values for `host` and `port`.
|
|
13
|
+
"""
|
|
14
|
+
url: Optional[str] = None
|
|
15
|
+
"""Either host or str of "Optional[scheme], host, Optional[port], Optional[prefix]".
|
|
16
|
+
"""
|
|
17
|
+
port: Optional[int] = 6333
|
|
18
|
+
"""Port of the REST API interface.
|
|
19
|
+
"""
|
|
20
|
+
grpc_port: int = 6334
|
|
21
|
+
"""Port of the gRPC interface.
|
|
22
|
+
"""
|
|
23
|
+
prefer_grpc: bool = False
|
|
24
|
+
"""If `true` - use gPRC interface whenever possible in custom methods.
|
|
25
|
+
"""
|
|
26
|
+
https: Optional[bool] = None
|
|
27
|
+
"""If `true` - use HTTPS(SSL) protocol. Default: `None`
|
|
28
|
+
"""
|
|
29
|
+
api_key: Optional[str] = None
|
|
30
|
+
"""API key for authentication in Qdrant Cloud.
|
|
31
|
+
"""
|
|
32
|
+
prefix: Optional[str] = None
|
|
33
|
+
""" If not `None` - add `prefix` to the REST URL path.
|
|
34
|
+
Example: `service/v1` will result in `http://localhost:6333/service/v1/{qdrant-endpoint}` for REST API.
|
|
35
|
+
Default: `None`
|
|
36
|
+
"""
|
|
37
|
+
timeout: Optional[int] = None
|
|
38
|
+
""" Timeout for REST and gRPC API requests.
|
|
39
|
+
Default: 5 seconds for REST and unlimited for gRPC
|
|
40
|
+
"""
|
|
41
|
+
host: Optional[str] = None
|
|
42
|
+
"""Host name of Qdrant service. If url and host are None, set to 'localhost'.
|
|
43
|
+
"""
|
|
44
|
+
path: Optional[str] = None
|
|
45
|
+
"""Persistence path for `QdrantLocal`.
|
|
46
|
+
"""
|
|
47
|
+
force_disable_check_same_thread: bool = False
|
|
48
|
+
""" For QdrantLocal, force disable check_same_thread. Default: `False`
|
|
49
|
+
Only use this if you can guarantee that you can resolve the thread safety outside QdrantClient.
|
|
50
|
+
"""
|
|
51
|
+
check_compatibility: bool = True
|
|
52
|
+
"""If `true` - check compatibility with the server version.
|
|
53
|
+
"""
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from contextlib import contextmanager
|
|
2
|
+
from typing import Generator
|
|
3
|
+
|
|
4
|
+
from dagster import ConfigurableResource
|
|
5
|
+
from pydantic import Field
|
|
6
|
+
from qdrant_client import QdrantClient
|
|
7
|
+
|
|
8
|
+
from .config import QdrantConfig
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class QdrantResource(ConfigurableResource):
|
|
12
|
+
config: QdrantConfig = Field(
|
|
13
|
+
description=(
|
|
14
|
+
"""Parameters to set up connection to a Qdrant service.
|
|
15
|
+
"""
|
|
16
|
+
),
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
@classmethod
|
|
20
|
+
def _is_dagster_mainatained(cls) -> bool:
|
|
21
|
+
return False
|
|
22
|
+
|
|
23
|
+
@contextmanager
|
|
24
|
+
def get_client(self) -> Generator[QdrantClient, None, None]:
|
|
25
|
+
conn = QdrantClient(**self.config.model_dump())
|
|
26
|
+
yield conn
|
|
27
|
+
|
|
28
|
+
conn.close()
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: dagster-qdrant
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Dagster integration with Qdrant
|
|
5
|
+
Requires-Python: >=3.9
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: dagster>=1.8.0
|
|
8
|
+
Requires-Dist: qdrant-client>=1.13.2
|
|
9
|
+
|
|
10
|
+
# dagster-qdrant
|
|
11
|
+
|
|
12
|
+
A Dagster module that provides an integration with [Qdrant](https://qdrant.tech/).
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
The `dagster_qdrant` module is available as a PyPI package - install with your preferred python
|
|
17
|
+
environment manager (We recommend [uv](https://github.com/astral-sh/uv)).
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
source .venv/bin/activate
|
|
21
|
+
uv pip install dagster-qdrant
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Example Usage
|
|
25
|
+
|
|
26
|
+
You can get a free-forever cloud instance from [cloud.qdrant.io](http://cloud.qdrant.io).
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from dagster_qdrant import QdrantConfig, QdrantResource
|
|
30
|
+
|
|
31
|
+
import dagster as dg
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@dg.asset
|
|
35
|
+
def my_table(qdrant_resource: QdrantResource):
|
|
36
|
+
with qdrant_resource.get_client() as qdrant:
|
|
37
|
+
qdrant.add(
|
|
38
|
+
collection_name="test_collection",
|
|
39
|
+
documents=[
|
|
40
|
+
"This is a document about oranges",
|
|
41
|
+
"This is a document about pineapples",
|
|
42
|
+
"This is a document about strawberries",
|
|
43
|
+
"This is a document about cucumbers",
|
|
44
|
+
],
|
|
45
|
+
)
|
|
46
|
+
results = qdrant.query(
|
|
47
|
+
collection_name="test_collection", query_text="hawaii", limit=3
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
defs = dg.Definitions(
|
|
52
|
+
assets=[my_table],
|
|
53
|
+
resources={
|
|
54
|
+
"qdrant_resource": QdrantResource(
|
|
55
|
+
config=QdrantConfig(
|
|
56
|
+
host="xyz-example.eu-central.aws.cloud.qdrant.io",
|
|
57
|
+
api_key="<your-api-key>",
|
|
58
|
+
)
|
|
59
|
+
)
|
|
60
|
+
},
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Development
|
|
66
|
+
|
|
67
|
+
The `Makefile` provides the tools required to test and lint your local installation.
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
make test
|
|
71
|
+
make ruff
|
|
72
|
+
make check
|
|
73
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
dagster_qdrant/__init__.py
|
|
4
|
+
dagster_qdrant/config.py
|
|
5
|
+
dagster_qdrant/resource.py
|
|
6
|
+
dagster_qdrant.egg-info/PKG-INFO
|
|
7
|
+
dagster_qdrant.egg-info/SOURCES.txt
|
|
8
|
+
dagster_qdrant.egg-info/dependency_links.txt
|
|
9
|
+
dagster_qdrant.egg-info/requires.txt
|
|
10
|
+
dagster_qdrant.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dagster_qdrant
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "dagster-qdrant"
|
|
3
|
+
version = "0.0.1"
|
|
4
|
+
description = "Dagster integration with Qdrant"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.9"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"dagster>=1.8.0",
|
|
9
|
+
"qdrant-client>=1.13.2",
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
[tool.uv]
|
|
13
|
+
dev-dependencies = [
|
|
14
|
+
"ruff",
|
|
15
|
+
"pytest",
|
|
16
|
+
"pyright>=1.1.386",
|
|
17
|
+
"fastembed>=0.5.1",
|
|
18
|
+
"testcontainers>=4.4.0"
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[build-system]
|
|
22
|
+
requires = ["setuptools>=42"]
|
|
23
|
+
build-backend = "setuptools.build_meta"
|
|
24
|
+
|
|
25
|
+
[tool.setuptools]
|
|
26
|
+
packages = ["dagster_qdrant"]
|