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