|
|
from pymilvus import Collection, connections |
|
|
from dotenv import load_dotenv |
|
|
import os |
|
|
load_dotenv() |
|
|
|
|
|
|
|
|
milvus_host = os.getenv("MILVUS_HOST", "milvus") |
|
|
milvus_port = os.getenv("MILVUS_PORT", "19530") |
|
|
|
|
|
connections.connect("default", host=milvus_host, port=int(milvus_port)) |
|
|
|
|
|
|
|
|
|
|
|
collection = Collection("faces") |
|
|
|
|
|
|
|
|
query = 'name == "YAB DATO SERI ANWAR IBRAHIM"' |
|
|
|
|
|
|
|
|
results = collection.query(query, output_fields=["id", "name"]) |
|
|
|
|
|
|
|
|
if results: |
|
|
ids_to_delete = [str(result["id"]) for result in results] |
|
|
id_expr = f"id in [{', '.join(ids_to_delete)}]" |
|
|
collection.delete(expr=id_expr) |
|
|
print(f"✅ Deleted entities: {ids_to_delete}") |
|
|
else: |
|
|
print("❌ No entities found for deletion.") |