Reference
srvdb.drop_links
Delete every link of a closed database after an older SrvDB changed it.
Delete every link between records of a closed database.
srvdb.drop_links(path: str) -> intParameters
Section titled “Parameters”- path : str Directory of a closed database.
Returns
Section titled “Returns”The number of links removed.
Raises
Section titled “Raises”-
FileNotFoundError No database at
path. -
BlockingIOError The database is open, in this process or another. Close it first.
-
OSError A file could not be read or written.
- Use it when
srvdb.openraisesRuntimeErrorsaying the links were written before an older SrvDB (0.3 or earlier, which ignores links) added, deleted or compacted records. Those links may point at the wrong records, so SrvDB refuses to open the database rather than use them or drop them silently. - Vectors and metadata are not changed. Link the records again afterwards.
- It never runs on its own.
Examples
Section titled “Examples”import srvdb
db = srvdb.create("./vectors", dimension=128)db.add(["a", "b"], [[1.0] + [0.0] * 127, [0.0, 1.0] + [0.0] * 126], ["{}", "{}"])db.link("a", "cites", "b")db.save()db.close()
print(srvdb.drop_links("./vectors"))# 1db = srvdb.open("./vectors")print(db.neighbors("a"), db.count())# [] 2See also
Section titled “See also”- Links between records: Durability and compatibility.
Was this page helpful? Tell us in Discussions.