DLT(数据加载工具)

DLT 是一个开源库,您可以将其添加到您的 Python 脚本中,以从各种通常杂乱的数据源加载数据到结构良好、实时的数据集中。

通过DLT-Qdrant集成,您现在可以选择Qdrant作为DLT目的地来加载数据。

DLT 启用

  • 自动化维护 - 通过模式推断、警报和简短的声明性代码,维护变得简单。
  • 在Python运行的地方运行它 - 在Airflow、无服务器函数、笔记本上。在微型和大型基础设施上都能扩展。
  • 用户友好、声明式的界面,消除了初学者的知识障碍,同时赋予高级专业人员更多能力。

用法

要开始使用,请安装带有qdrant额外功能的dlt

pip install "dlt[qdrant]"

在DLT密钥文件中配置目标。默认情况下,文件位于~/.dlt/secrets.toml。将以下部分添加到密钥文件中。

[destination.qdrant.credentials]
location = "https://your-qdrant-url"
api_key = "your-qdrant-api-key"

位置将默认为 http://localhost:6333 并且 api_key 未定义 - 这是本地 Qdrant 实例的默认设置。 有关 DLT 配置的更多信息,请访问 这里

定义数据的来源。

import dlt
from dlt.destinations.qdrant import qdrant_adapter

movies = [
    {
        "title": "Blade Runner",
        "year": 1982,
        "description": "The film is about a dystopian vision of the future that combines noir elements with sci-fi imagery."
    },
    {
        "title": "Ghost in the Shell",
        "year": 1995,
        "description": "The film is about a cyborg policewoman and her partner who set out to find the main culprit behind brain hacking, the Puppet Master."
    },
    {
        "title": "The Matrix",
        "year": 1999,
        "description": "The movie is set in the 22nd century and tells the story of a computer hacker who joins an underground group fighting the powerful computers that rule the earth."
    }
]

定义管道。

pipeline = dlt.pipeline(
    pipeline_name="movies",
    destination="qdrant",
    dataset_name="movies_dataset",
)

运行管道。

info = pipeline.run(
    qdrant_adapter(
        movies,
        embed=["title", "description"]
    )
)

数据现已加载到Qdrant中。

要在数据加载后使用向量搜索,您必须指定Qdrant需要为哪些字段生成嵌入。您可以通过使用qdrant_adapter函数包装数据(或DLT资源)来实现这一点。

写入配置

DLT 写入处置定义了数据应如何写入目标。Qdrant目标支持所有写入处置。

DLT 同步

Qdrant 目的地支持同步 DLT 状态

下一步

这个页面有用吗?

感谢您的反馈!🙏

我们很抱歉听到这个消息。😔 你可以在GitHub上编辑这个页面,或者创建一个GitHub问题。