rvztz ce905dd098
feat: Weaviate destination connector (#1963)
Closes #1781.
- Adds a Weaviate destination connector
- The connector receives a host for the weaviate instance and a weaviate
class name.
- Defines a weaviate schema for json elements.
- Defines the pre-processing to conform unstructured's schema to the
proposed weaviate schema.
2023-12-01 22:27:41 +00:00

22 lines
485 B
Python
Executable File

#!/usr/bin/env python3
import json
import os
import weaviate
weaviate_host_url = os.getenv("WEAVIATE_HOST_URL", "http://localhost:8080")
class_name = os.getenv("WEAVIATE_CLASS_NAME", "Elements")
new_class = None
with open("./scripts/weaviate-test-helpers/elements.json") as f:
new_class = json.load(f)
client = weaviate.Client(
url=weaviate_host_url,
)
if client.schema.exists(class_name):
client.schema.delete_class(class_name)
client.schema.create_class(new_class)