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"

位置默认为 https://:6333api_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 问题。