Spaces:
Build error
Build error
Commit
·
41b5bdf
1
Parent(s):
dbfca31
Update weaviate_utils.py
Browse files- weaviate_utils.py +13 -1
weaviate_utils.py
CHANGED
@@ -46,4 +46,16 @@ def ingest_data_to_weaviate(client, dataframe, class_name, class_description):
|
|
46 |
}
|
47 |
try:
|
48 |
client.schema.property.create(class_name, property_schema)
|
49 |
-
except weaviate.exceptions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
}
|
47 |
try:
|
48 |
client.schema.property.create(class_name, property_schema)
|
49 |
+
except weaviate.exceptions.SchemaValidationException:
|
50 |
+
# Property might already exist, so we can continue
|
51 |
+
pass
|
52 |
+
|
53 |
+
# Now, let's ingest the data
|
54 |
+
data = dataframe.to_dict(orient="records")
|
55 |
+
client.data_object.create(data, class_name)
|
56 |
+
|
57 |
+
def get_class_schema(client, class_name):
|
58 |
+
try:
|
59 |
+
return client.schema.get_class(class_name)
|
60 |
+
except weaviate.exceptions.SchemaValidationException:
|
61 |
+
return None
|