How to remove reference property

we have added the following ref property, now wondering how to remove it without recreating the collection and losing data.

from weaviate.classes.config import ReferenceProperty

category = client.collections.get(“Rechtspraak_nl”)
category.config.add_reference(
ReferenceProperty(
name=“extracted_content_outline”,
target_collection=“Rechtspraak_nl_metadata”
)
)

so is there a way using python client to remove this refrence ?

Hello!

Removing properties (data and references) is not possible. You’d have to create a new collection and transfer your data over. Or simply ignore that the reference property is there

Thanks for the fast reply.

How to transfer your data over from one collection to another , is it easy ?

Or simply ignore that the reference property is there
I wish to ignore it, however, I am currently getting error when appending to the schema getting the following error:

code to append:
to_add.withColumnRenamed(“id”, “uuid”)
.write.format(“io.weaviate.spark.Weaviate”)
.option(“batchSize”, 200)
.option(“scheme”, “http”)
.option(“host”, weaviate_url)
.option(“id”, “uuid”)
.option(“grpc:host”, “10.2.0.13:50051”)
.option(“grpc:secured”, “false”)
.option(“className”, schema[‘class’])
.mode(“append”).save()

Error:
[INCOMPATIBLE_DATA_FOR_TABLE.CANNOT_FIND_DATA] Cannot write incompatible data for the table Rechtspraak_nl: Cannot find data for the output column ecli_uuid. SQLSTATE: KD000

Diagnose errorHighlight error

And the schema have 2 references that we added recently :

“references”: [
{
“name”: “ecli_uuid”,
“description”: null,
“target_collections”: [
“Rechtspraak_nl_metadata”
]
},
{
“name”: “extracted_content_outline”,
“description”: null,
“target_collections”: [
“Rechtspraak_nl_metadata”
]
}
],

should we add 2 empty columns for the 2 references in the datafram when writing to weaviate ?

In the python client you could just leave it out. Not sure about the spark connector, I’ll ping someone :slight_smile:

btw if we have 2 collections
one for document data (id, chunks) and one for document metadata (id, summery, …)
we want to connect the collections using references, to avoid duplicating all the metadata for each chunk/row.

in this case we create the reference based on the document unique id or based on the specific fields we need from metadata collection ?

so for example:

from weaviate.classes.config import ReferenceProperty

category = client.collections.get(“document_data”)
category.config.add_reference(
ReferenceProperty(
name=“document_id”,
target_collection=“document_metadata” ) )

or we create the reference based on the specific fields we need :

from weaviate.classes.config import ReferenceProperty

category = client.collections.get(“document_data”)
category.config.add_reference(
ReferenceProperty(
name=“document_summary”,
target_collection=“document_metadata” ) )

And how we insert in different cases ?