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

Collection Reference turned into UUID, and couldn't be link

$
0
0

Hi!

I was not able to create the collections using this schema.

I got this error, due to the data type “vector” that is not valid:

        {
          "name": "simhash",
          "dataType": [
            "vector"
          ]
        },

this was the error:

UnexpectedStatusCodeError: Collection may not have been created properly.! Unexpected status code: 422, with response body: {‘error’: [{‘message’: “property ‘simhash’: invalid dataType: unknown primitive data type ‘vector’”}]}.

I was able to comment that property, and create the class, however it was working properly.

I have used python v4 syntax (you are using python v3). Here is what I have done:

import weaviate
client = weaviate.connect_to_local()
print(weaviate.__version__, client.get_meta().get("version"))

schema = {
  "classes": [
    {
      "class": "Pack",
      "properties": [
        {
          "name": "pack_name",
          "dataType": [
            "string"
          ]
        },
        {
          "name": "version",
          "dataType": [
            "string"
          ]
        },
        {
          "name": "author",
          "dataType": [
            "string"
          ]
        },
        {
          "name": "website",
          "dataType": [
            "string"
          ]
        },
        {
          "name": "state",
          "dataType": [
            "string"
          ]
        },
        {
          "name": "date",
          "dataType": [
            "date"
          ]
        }
      ]
    },
    {
      "class": "TextFile",
      "properties": [
        {
          "name": "path_in_pack",
          "dataType": [
            "string"
          ]
        },
        # {
        #   "name": "simhash",
        #   "dataType": [
        #     "vector"
        #   ]
        # },
        {
          "name": "sequences",
          "dataType": [
            "string[]"
          ]
        },
        {
          "name": "belongs_to_pack",
          "dataType": [
            "Pack"
          ]
        },
        {
          "name": "md5",
          "dataType": [
            "string"
          ]
        }
      ],
      "vectorIndexConfig": {
        "distance": "hamming"
      }
    },
    {
      "class": "ImageFile",
      "properties": [
        {
          "name": "md5",
          "dataType": [
            "string"
          ]
        },
        {
          "name": "path_in_pack",
          "dataType": [
            "string"
          ]
        },
        {
          "name": "histogram",
          "dataType": [
            "vector"
          ]
        },
        {
          "name": "phash",
          "dataType": [
            "vector"
          ]
        },
        {
          "name": "lbp_features",
          "dataType": [
            "vector"
          ]
        },
        {
          "name": "belongs_to_pack",
          "dataType": [
            "Pack"
          ]
        }
      ]
    },
    {
      "class": "AudioFile",
      "properties": [
        {
          "name": "path_in_pack",
          "dataType": [
            "string"
          ]
        },
        {
          "name": "belongs_to_pack",
          "dataType": [
            "Pack"
          ]
        },
        {
          "name": "md5",
          "dataType": [
            "string"
          ]
        }
      ]
    }
  ]
}

c = client.collections.create_from_dict(schema["classes"][0])
c = client.collections.create_from_dict(schema["classes"][1])

we have now created the first and second classes.

And the property that is a cross reference is correctly created:

collection = client.collections.get("TextFile")
for p in collection.config.get().references:
    print("----")
    print(p)

here is the output:

_ReferenceProperty(name='belongs_to_pack', description=None, target_collections=['Pack'])

Let me know if this hels!

Thanks!


Viewing all articles
Browse latest Browse all 3590

Trending Articles