Quantcast
Channel: Weaviate Community Forum - Latest posts
Viewing all articles
Browse latest Browse all 3601

AttributeError: 'WeaviateClient' object has no attribute 'query'

$
0
0

hi @Kaan_Tiftikci !!

Welcome to our community :hugs:

Can you share the code you are using? It seems like you are using different client versions.

This is python v3 client:

v3c = weaviate.Client("http://localhost:8080")
v3c.query.get("Test", "text").do()

and this is the python v4 client:

client = weaviate.connect_to_local()
collection = client.collections.get("Test")
collection.query.fetch_objects().objects

Note that the python v3 client is included in the python v4 client package. However, it is deprecated, a will be removed in future versions. Right now, if you instantiate a v3 client using the v4 client package, this warning will be printed:

DeprecationWarning:
Python client v3 weaviate.Client(...) connections and methods are deprecated and will
be removed by 2024-11-30.

        Upgrade your code to use Python client v4 `weaviate.WeaviateClient` connections and methods.
            - For Python Client v4 usage, see: https://weaviate.io/developers/weaviate/client-libraries/python
            - For code migration, see: https://weaviate.io/developers/weaviate/client-libraries/python/v3_v4_migration

        If you have to use v3 code, install the v3 client and pin the v3 dependency in your requirements file: `weaviate-client>=3.26.7;<4.0.0`

So this exact error you mentioned will surface when you call .query on the python v4 client:

client.query

AttributeError Traceback (most recent call last) Cell In[9], line 1 ----> 1 client.query AttributeError: ‘WeaviateClient’ object has no attribute ‘query’

Let me know if this helps!


Viewing all articles
Browse latest Browse all 3601

Trending Articles