Hi @moruga123 !
Those are really interesting findings. While we suggest, as a convention, PascalCase for the Collection name and lowercase for the property names
Enforcing those can bring unnecessary friction for the DX.
I have consolidated your code here for better reproducibility (and removed unnecessary parts):
import weaviate
from weaviate import classes as wvc
client = weaviate.connect_to_local()
client.collections.delete("lowercase")
lowercase = client.collections.create(
name='lowercase',
properties=[
wvc.config.Property(name="CONTENT", data_type=wvc.config.DataType.TEXT, skip_vectorization=False, index_searchable=True),
wvc.config.Property(name="URL", data_type=wvc.config.DataType.TEXT, skip_vectorization=True, index_searchable=True),
wvc.config.Property(name="URL_2", data_type=wvc.config.DataType.TEXT, skip_vectorization=True, index_searchable=True),
# this doesn't work:
#wvc.config.Property(name="URL:2", data_type=wvc.config.DataType.TEXT, skip_vectorization=True, index_searchable=True),
],
vectorizer_config=None
)
print(lowercase.config.get().properties)
# insert some document
# MAKE SURE YOU HAVE AUTOSCHEMA_ENABLED: 'false' in your docker compose
lowercase.data.insert({
"CONTENT": "content", "URL": "http://weaviate.io"
})
# lets fetch our objects
query = lowercase.query.fetch_objects()
# NOTHING HERE
print("NOTHING HERE: ", query.objects[0].properties.get("CONTENT"))
# CONTENT IS IN FACT HERE
print("CONTENT IS IN FACT HERE: ", query.objects[0].properties.get("cONTENT"))
Also, I have found some discussions about this here:
opened 05:25PM - 27 Apr 21 UTC
closed 12:53PM - 24 Sep 21 UTC
Seems that only [a-z]* names are supported. I cannot add field names to a class… with number or underscored in them.
`Create class! Unexpected status code: 422, with response body: {'error': [{'message': "'label_a' is not a valid property name"}]}`
`Create class! Unexpected status code: 422, with response body: {'error': [{'message': "'label1' is not a valid property name"}]}`
On top of that, I exported the created collection and imported using the v3 client, so this all happens on the server side:
lowercase_schema = lowercase.config.get().to_dict()
lowercase_schema["class"] = "v3class"
clientv3 = weaviate.Client("http://localhost:8080")
clientv3.schema.create_class(lowercase_schema)
v3class.config.get().properties
and got the same results. I also agree here:
However, it would be better if the properties were left alone…
While the collection name is easier to avoid this friction, the property is not, as you pointed out.
I believe the best course of action here is to raise an issue in GH: