Skip to content

Commit f12d361

Browse files
committed
feat: support nebular database
1 parent 19ee7ba commit f12d361

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/memos/graph_dbs/nebular.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ def __init__(self, config: NebulaGraphDBConfig):
113113
username=config.get("user_name"),
114114
password=config.get("password"),
115115
)
116+
self.db_name = config.db_name
116117
self.space = config.get("space")
117118
self.user_name = config.user_name
118119
self.system_db_name = "system" if config.use_multi_db else config.space
@@ -854,7 +855,14 @@ def drop_database(self) -> None:
854855
Permanently delete the entire database this instance is using.
855856
WARNING: This operation is destructive and cannot be undone.
856857
"""
857-
raise NotImplementedError
858+
if self.config.use_multi_db:
859+
self.client.execute(f"DROP DATABASE {self.db_name} IF EXISTS")
860+
logger.info(f"Database '{self.db_name}' has been dropped.")
861+
else:
862+
raise ValueError(
863+
f"Refusing to drop protected database: {self.db_name} in "
864+
f"Shared Database Multi-Tenant mode"
865+
)
858866

859867
def detect_conflicts(self) -> list[tuple[str, str]]:
860868
"""

0 commit comments

Comments
 (0)