Weaviate V4 Python client not able to aggregate newly created collections

Description

I have weaviate v1.25.2 setup using devcontainer, and I’m talking with it using FastAPI and V4 Python client.

I created an endpoint to create collections like this:

@router.post('/', name='create_collection')
async def create_collection(
  create_collection_request: CreateCollectionRequest,
  client: weaviate.WeaviateClient=Depends(get_weaviate_client),
):
  if not client.collections.exists(create_collection_request.name):
    client.collections.create(
      name=create_collection_request.name,
      properties=[
        wc.Property(name=property.name, data_type=property.type) for property in create_collection_request.properties
      ],
      vectorizer_config=wc.Configure.Vectorizer.none(),
    )

    return { 'status': 'ok', 'message': f'Collection "{create_collection_request.name}" created successfully.' }
  else:
    return { 'status': 'not modified', 'message': f'Collection "{create_collection_request.name}" exists already.' }

And I want to create an endpoint to get the number of objects in a collection like this:

@router.get('/{collection_name}', name='get_collection')
async def get_collection(
  collection_name: str,
  client: weaviate.WeaviateClient=Depends(get_weaviate_client),
) -> GetCollectionRequest:
  if client.collections.exists(collection_name):
    collection = client.collections.get(name=collection_name)
    
    return GetCollectionRequest(
      name=collection_name,
      size=collection.aggregate.over_all(total_count=True).total_count,
    )
  else:
    return { 'status': 'not found', 'message': f'Collection "{collection_name}" does not exist.' }

The issue is the get request is raising the following exception:

weaviate.exceptions.UnexpectedStatusCodeError: Query was not successful! Unexpected status code: 422, with response body: {'error': [{'message': 'no graphql provider present, this is most likely because no schema is present. Import a schema first!'}]}.

I searched for hour with nothing, any thought please?

Server Setup Information

  • Weaviate Server Version: 1.25.2
  • Deployment Method: docker/devcontainer
  • Multi Node? Number of Running Nodes: 1
  • Client Language and Version: Python v4.6.3
  • Multitenancy?: No

Answering my own question :3

From weaviate docker logs:

weaviate-1 | {“action”:“graphql_rebuild”,“error”:“Could not build GraphQL schema, because: Schema must contain unique named types but contains multiple types named "String".”,“level”:“error”,“msg”:“could not (re)build graphql provider”,“time”:“2024-06-03T09:06:51Z”}

I was testing with the default values from FastAPI endpoints explorer, and the default value for a text field is “string”, and it looks like weaviate is not accepting a collection named “string” for some reason. Changing the collection name to something else works fine.

Can you please confirm if there is any preserved collection names? And if yes, could you please add this to the docs?