{"record":{"id":"eb96a1aa1ed00ee7","repo":"lancedb/lancedb","slug":"drop-database-is-deprecated-use-drop-all-tables-i","errorCode":null,"errorMessage":"drop_database is deprecated, use drop_all_tables instead","messagePattern":"drop_database is deprecated, use drop_all_tables instead","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"python/python/lancedb/namespace.py","lineNumber":713,"sourceCode":"        if new_namespace_path is None:\n            new_namespace_path = []\n        try:\n            LOOP.run(\n                self._inner.rename_table(\n                    cur_name,\n                    new_name,\n                    cur_namespace_path=cur_namespace_path,\n                    new_namespace_path=new_namespace_path,\n                )\n            )\n        except RuntimeError as e:\n            if \"rename_table not implemented\" in str(e):\n                raise NotImplementedError(\"rename_table not implemented\") from e\n            raise\n\n    @override\n    def drop_database(self):\n        raise NotImplementedError(\n            \"drop_database is deprecated, use drop_all_tables instead\"\n        )\n\n    @override\n    def drop_all_tables(self, namespace_path: Optional[List[str]] = None):\n        if namespace_path is None:\n            namespace_path = []\n        LOOP.run(self._inner.drop_all_tables(namespace_path=namespace_path))\n\n    @override\n    def list_namespaces(\n        self,\n        namespace_path: Optional[List[str]] = None,\n        page_token: Optional[str] = None,\n        limit: Optional[int] = None,\n    ) -> ListNamespacesResponse:\n        \"\"\"\n        List child namespaces under the given namespace.","sourceCodeStart":695,"sourceCodeEnd":731,"githubUrl":"https://github.com/lancedb/lancedb/blob/c7b051aff7039333a3f61b79217246c27676806a/python/python/lancedb/namespace.py#L695-L731","documentation":"Raised unconditionally by NamespaceDb.drop_database, which is deliberately deprecated. Database dropping was replaced by namespace-scoped operations in the namespace API, so this method always raises NotImplementedError directing users to drop_all_tables instead. It is an intentional migration guard, not a runtime failure.","triggerScenarios":"Any call to db.drop_database() on a NamespaceDb connection, regardless of state or arguments.","commonSituations":"Migrating legacy code that used drop_database against older lancedb versions; scripts cleaning up environments that copy the old API usage.","solutions":["Replace drop_database() with drop_all_tables(namespace_path) to clear tables in a namespace.","Use drop_namespace(path) if the intent was to remove the whole namespace.","Remove the drop_database call entirely if environment cleanup is handled elsewhere."],"exampleFix":"// before\ndb.drop_database()\n// after\ndb.drop_all_tables(namespace_path=[\"prod\"])","handlingStrategy":"validation","validationCode":"if hasattr(db, \"drop_database\") and type(db).__name__ == \"NamespaceDb\":\n    raise RuntimeError(\"drop_database is deprecated; use drop_all_tables\")","typeGuard":null,"tryCatchPattern":"try:\n    db.drop_database()\nexcept NotImplementedError:\n    db.drop_all_tables(namespace_path=path)","preventionTips":["Grep legacy scripts for drop_database and migrate them to drop_all_tables/drop_namespace.","Treat deprecated methods as unavailable on NamespaceDb connections.","Pin and read changelogs when upgrading lancedb versions."],"tags":["python","namespace","deprecated","drop-database"],"backgroundTag":"deprecated-api-usage","analyzedSha":"c7b051aff7039333a3f61b79217246c27676806a","analyzedAt":"2026-09-08T23:42:37.579Z","contentChangedAt":"2026-09-08T23:42:37.579Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}