MCPcopy Create free account
hub / github.com/nlweb-ai/NLWeb / delete_site_from_database

Function delete_site_from_database

AskAgent/python/data_loading/db_load.py:98–125  ·  view source on GitHub ↗

Delete all entries for a specific site from the configured database. Args: site: Site identifier to delete database: Specific database to use (if None, uses preferred endpoint) Returns: Number of entries deleted

(site: str, database: str | None = None)

Source from the content-addressed store, hash-verified

96 return embeddings_path
97
98async def delete_site_from_database(site: str, database: str | None = None):
99 """
100 Delete all entries for a specific site from the configured database.
101
102 Args:
103 site: Site identifier to delete
104 database: Specific database to use (if None, uses preferred endpoint)
105
106 Returns:
107 Number of entries deleted
108 """
109 # Use specified database or fall back to preferred endpoint
110 endpoint_name = database or CONFIG.write_endpoint
111
112 # Ensure the endpoint exists in configuration
113 if endpoint_name not in CONFIG.retrieval_endpoints:
114 raise ValueError(f"Database endpoint '{endpoint_name}' not found in configuration")
115
116 # Use query_params for development mode override
117 query_params = {"db": database} if database else None
118
119 print(f"Deleting entries for site '{site}' using endpoint '{endpoint_name}'...")
120
121 # Use the wrapper function for deletion
122 deleted_count = await delete_documents_by_site(site, query_params=query_params)
123
124 print(f"Deleted {deleted_count} documents for site '{site}'")
125 return deleted_count
126
127async def is_url(path: str) -> bool:
128 """

Callers 4

loadJsonToDBFunction · 0.85
loadUrlListToDBFunction · 0.85
delete_siteFunction · 0.85

Calls 1

delete_documents_by_siteFunction · 0.90

Tested by

no test coverage detected