Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot update collection description with Python Client #1060

Closed
henrymcl opened this issue May 12, 2024 · 1 comment
Closed

Cannot update collection description with Python Client #1060

henrymcl opened this issue May 12, 2024 · 1 comment

Comments

@henrymcl
Copy link

henrymcl commented May 12, 2024

Expected outcome:

Description gets updated

Actual outcome:

Description remains as Test.

Minimal reproduction

These three files shall be put in same folder:

main.py

import time

from weaviate.classes.config import DataType, Property

from weaviate import connect_to_custom

try:
    while True:
        try:
            weaviate_client = connect_to_custom(
                http_host="weaviate",
                http_port="8085",
                http_secure=False,
                grpc_host="weaviate",
                grpc_port="50051",
                grpc_secure=False,
            )
            break
        except:
            print("Error connecting")
            time.sleep(1)

    def delete_collection(name: str):
        try:
            weaviate_client.collections.delete(name)
        except:
            pass

    def create_collection(name: str):
        weaviate_client.collections.create(
            name,
            description=name,
            properties=[
                Property(
                    name="text",
                    description="Field",
                    data_type=DataType.TEXT,
                    skip_vectorization=True,
                    index_filterable=True,
                    index_searchable=False,
                )
            ],
        )

    def update_collection(name: str):
        collection = weaviate_client.collections.get(name=name)
        collection.config.update(description="Updated")

    NAME = "Test"
    delete_collection(NAME)
    create_collection(NAME)
    collection1 = weaviate_client.collections.get(name=NAME)
    config1 = collection1.config.get()
    print("BEFORE", config1.description, flush=True)

    update_collection(NAME)
    collection2 = weaviate_client.collections.get(name=NAME)
    config2 = collection2.config.get()
    print("AFTER", config2.description, flush=True)
except Exception as e:
    print(e, flush=True)
    pass

while True:
    time.sleep(1)

Dockerfile:

FROM python:3.11.6-slim

RUN apt-get update

WORKDIR /app

RUN pip install -U weaviate-client

compose.yaml:

services:
  server:
    build: .
    working_dir: /app
    volumes:
      - .:/app
    depends_on:
      - weaviate
    command: python3 /app/main.py
  weaviate:
    command:
      - --host
      - 0.0.0.0
      - --port
      - "8085"
      - --scheme
      - http
    image: semitechnologies/weaviate:1.25.0
    volumes:
      - ./weaviate:/var/lib/weaviate
    restart: on-failure:0
    environment:
      PYTHONASYNCIODEBUG: 1
      QUERY_DEFAULTS_LIMIT: 25
      LIMIT_RESOURCES: "true"
      AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: "true"
      PERSISTENCE_DATA_PATH: "/var/lib/weaviate"
      DEFAULT_VECTORIZER_MODULE: "none"
      ENABLE_MODULES: "tiktoken_ext.openai_public"
      CLUSTER_HOSTNAME: "node1"

Steps to Reproduce:

  1. View the docker log.

This is using weaviate-client==4.6.2 and weaviate:1.25.1

@dirkkul
Copy link
Collaborator

dirkkul commented May 24, 2024

This should be fixed in weaviate/weaviate#4982 and will be in the next point release (1.25.2 I think)

@dirkkul dirkkul closed this as completed May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants