Error : no graphql provider present, this is most likely because no schema is present. Import a schema first!

Hello everyone!

After having recreated my Weaviate class instance with two extra properties, I suddenly get the error the following exception when trying to retrieve data from that class:

UnexpectedStatusCodeException: 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 never had this exception before and am not sure what I might have done wrong.

This is the function I use to create classes :

# CREATE CLASS
def create_class(self, 
    class_name: str,
    class_description: str,
    vectorizer: str = "text2vec-openai"
):
    # Create list of properties
    class_obj = {
        "class": class_name,
        "description": class_description,
        "properties": [
            {
                "dataType": ["text"],
                "indexSearchable": True,
                "description": "Title of the document.",
                "name": "title",
                "tokenization": "word"
            },
            {
                "dataType": ["text"],
                "indexSearchable": True,
                "description": "The text itself",
                "name": "body",
                "tokenization": "word"                 
            },
            {
                "dataType": ["int"],
                "description": "Page number / time stamp fragment",
                "name": "referenceLocation",
            },
            {
                "dataType": ["text"],
                "description": "Unit of the page number/timestamp",
                "name": "unit",
            },
            {
                "dataType": ["text"],
                "indexSearchable": True,
                "description": "Type of document.",
                "name": "documentType",
                "tokenization": "word"                 
            },
            {
                "dataType": ["text"],
                "indexSearchable": True,
                "description": "Type of document.",
                "name": "url",
                "tokenization": "word"                 
            },

        ]
    }

    class_obj["vectorizer"] = vectorizer
    self.client.schema.create_class(class_obj)

    return {"Status": f"The collection {class_name} has been created."}

Data has been added by parsing PDFs.

Now when I check if the class exists, that still works, it correctly returns True, and I can also check the schema of the class, which returns this :

{
  "class": "Geschiedenis",
  "description": "Leermaterial ASO1 voor het vak Geschiedenis",
  "invertedIndexConfig": {
    "bm25": {
      "b": 0.75,
      "k1": 1.2
    },
    "cleanupIntervalSeconds": 60,
    "stopwords": {
      "additions": null,
      "preset": "en",
      "removals": null
    }
  },
  "moduleConfig": {
    "text2vec-openai": {
      "baseURL": "https://api.openai.com",
      "model": "ada",
      "modelVersion": "002",
      "type": "text",
      "vectorizeClassName": true
    }
  },
  "multiTenancyConfig": {
    "enabled": false
  },
  "properties": [
    {
      "dataType": [
        "text"
      ],
      "description": "Title of the document.",
      "indexFilterable": true,
      "indexSearchable": true,
      "moduleConfig": {
        "text2vec-openai": {
          "skip": false,
          "vectorizePropertyName": false
        }
      },
      "name": "title",
      "tokenization": "word"
    },
    {
      "dataType": [
        "text"
      ],
      "description": "The text itself",
      "indexFilterable": true,
      "indexSearchable": true,
      "moduleConfig": {
        "text2vec-openai": {
          "skip": false,
          "vectorizePropertyName": false
        }
      },
      "name": "body",
      "tokenization": "word"
    },
    {
      "dataType": [
        "int"
      ],
      "description": "Page number / time stamp fragment",
      "indexFilterable": true,
      "indexSearchable": false,
      "moduleConfig": {
        "text2vec-openai": {
          "skip": false,
          "vectorizePropertyName": false
        }
      },
      "name": "referenceLocation"
    },
    {
      "dataType": [
        "text"
      ],
      "description": "Unit of the puge number/timestamp",
      "indexFilterable": true,
      "indexSearchable": true,
      "moduleConfig": {
        "text2vec-openai": {
          "skip": false,
          "vectorizePropertyName": false
        }
      },
      "name": "unit",
      "tokenization": "word"
    },
    {
      "dataType": [
        "text"
      ],
      "description": "Type of document.",
      "indexFilterable": true,
      "indexSearchable": true,
      "moduleConfig": {
        "text2vec-openai": {
          "skip": false,
          "vectorizePropertyName": false
        }
      },
      "name": "documentType",
      "tokenization": "word"
    },
    {
      "dataType": [
        "text"
      ],
      "description": "Type of document.",
      "indexFilterable": true,
      "indexSearchable": true,
      "moduleConfig": {
        "text2vec-openai": {
          "skip": false,
          "vectorizePropertyName": false
        }
      },
      "name": "url",
      "tokenization": "word"
    }
  ],
  "replicationConfig": {
    "factor": 1
  },
  "shardingConfig": {
    "virtualPerPhysical": 128,
    "desiredCount": 1,
    "actualCount": 1,
    "desiredVirtualCount": 128,
    "actualVirtualCount": 128,
    "key": "_id",
    "strategy": "hash",
    "function": "murmur3"
  },
  "vectorIndexConfig": {
    "skip": false,
    "cleanupIntervalSeconds": 300,
    "maxConnections": 64,
    "efConstruction": 128,
    "ef": -1,
    "dynamicEfMin": 100,
    "dynamicEfMax": 500,
    "dynamicEfFactor": 8,
    "vectorCacheMaxObjects": 1000000000000,
    "flatSearchCutoff": 40000,
    "distance": "cosine",
    "pq": {
      "enabled": false,
      "bitCompression": false,
      "segments": 0,
      "centroids": 256,
      "trainingLimit": 100000,
      "encoder": {
        "type": "kmeans",
        "distribution": "log-normal"
      }
    }
  },
  "vectorIndexType": "hnsw",
  "vectorizer": "text2vec-openai"
}

However, when I try to run a query on my data or retrieve data, e.g. like the following :

    def get_data(self, 
        class_name: str, 
        batch_size: int = None, 
        return_prop: List[str] = ['title', 'body', 'referenceLocation', 'unit', 'url', 'documentType'], 
        cursor: UUID = None
    ) -> dict:
        query = (
            self.client.query.get(
                class_name=class_name,
                properties=return_prop
            )
            .with_additional(["id"])
            .with_limit(batch_size)
        )

        # fetch next set of results
        if cursor is not None:
            result = query.with_after(cursor).do()
        else:
            result = query.do()
        
        return result["data"]["Get"][class_name]

I get this error :

UnexpectedStatusCodeException: 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!'}]}.

Does anyone maybe know what is causing this error? As you could see, I did import a schema and I can retrieve it, but when retrieving data, it says that there is no schema present.

Thanks a lot!

Birgit

Hi @birgitbartels ! Welcome to our community :hugs:

This usually happens when there is not even one class in your cluster.

Can you please run the following, considering you are using python client v3:

client.schema.get()

This will get you all the schemas present on that cluster.

Thanks!

Dear @DudaNogueira ,

Thank you for your answer!

When I run the following code, as when I do the same but specifying the class name, the schema is returned, so that still works like before. I also verified the schemas of course, all 11 classes I had made are inside and they contain all the properties I specified in my class object. Importing data also seems to work like before, it is only when I try to retrieve data that the error persists.

Are there other things that activate the 422 response code?

Kind regards,

Birgit

Hi!

What are the version you are running?

Can you migrate this data to a new cluster, and reproduce this?

When you call, outside your app,

client.schema.get("NameOfClass")

do you get the same error?

Thanks!

Hu @DudaNogueira

Thank you for your answer.

I recently just deleted everything and ran my code again to create everything from scratch, and now it works again.

So I don’t know what exactly went wrong, but I am happy to say that a full restart did the trick.

Kind regards,

Birgit Bartels

1 Like