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

I’m trying to update my code from v3 to v4, but I’m finding the migration code lacking in basic info, such as simply how one would update client.schema.get() to v4. What is the equivalent in v4?

cc: @sebastian and @DaveCuthbert

Hi @nick-youngblut, thank you for reaching out.

Naming convention

In V4 we changed the naming convention around the schema, we call it now collection configuration.
And property schema refers to type definition for all properties in a collection (but this doesn’t include vectorizers or index configuration).

Get Collection Config

To get collection configuration (what we used to call schema), you can call:

A) Get all collections
You can request a dictionary with all collection configurations.
Then, you can access each collection with the collection name as a key.

# Get all collection
col_configs = client.collections.list_all()

# Print all collection names
for name in col_configs:

# Print one collection configuration
print(col_configs["MyCollection"].properties)        # property schema
print(col_configs["MyCollection"].vectorizer_config) # vectorizer configuration
print(col_configs["MyCollection"].vectorizer)        # vectorizer name

B) Get selected collection
You can get the collection configuration from the collection object.
(I personally prefer to work with the collection object as my gateway to 99% of what I do with Weaviate).

collection = client.collections.get("MyCollection")
config = collection.config.get()


Happy to help

Let me know if we can help with other examples.
In the meantime, we will update the docs with extra examples of before (v3) and after (v4).

Thanks @sebawita! Where is client.collections.list_all() described in the docs? I don’t see it at Migrate from v3 to v4 or elsewhere.

Hi Nick,
list_all is not listed (pun not intended) in the migration docs, but we can add it there in case others miss that one too.

We have it covered in the Manage Collections docs, but I can see why this wouldn’t be easy when you are used to working with the v3 client.

Let me know if I can point you towards other functions :wink: