lancedb/lancedb · error · NotImplementedError

drop_database is deprecated, use drop_all_tables instead

Error message

drop_database is deprecated, use drop_all_tables instead

What it means

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.

Solutions

  1. Replace drop_database() with drop_all_tables(namespace_path) to clear tables in a namespace.
  2. Use drop_namespace(path) if the intent was to remove the whole namespace.
  3. Remove the drop_database call entirely if environment cleanup is handled elsewhere.

Example fix

// before
db.drop_database()
// after
db.drop_all_tables(namespace_path=["prod"])
Defensive patterns

Strategy: validation

Validate before calling

if hasattr(db, "drop_database") and type(db).__name__ == "NamespaceDb":
    raise RuntimeError("drop_database is deprecated; use drop_all_tables")

Try / catch

try:
    db.drop_database()
except NotImplementedError:
    db.drop_all_tables(namespace_path=path)

Prevention

When it happens

Trigger: Any call to db.drop_database() on a NamespaceDb connection, regardless of state or arguments.

Common situations: Migrating legacy code that used drop_database against older lancedb versions; scripts cleaning up environments that copy the old API usage.

Understand the failure class

Background: "is deprecated and will be removed" — deprecation warnings for old API names, keywords, and options, and how to migrate before the removal release — this error's family across 29 libraries.

Related errors


AI-assisted analysis of lancedb/lancedb@c7b051aff7 (2026-09-08). Data as JSON: /api/errors/eb96a1aa1ed00ee7. Report an issue: GitHub.

Appendix: source

Thrown at python/python/lancedb/namespace.py:713

        if new_namespace_path is None:
            new_namespace_path = []
        try:
            LOOP.run(
                self._inner.rename_table(
                    cur_name,
                    new_name,
                    cur_namespace_path=cur_namespace_path,
                    new_namespace_path=new_namespace_path,
                )
            )
        except RuntimeError as e:
            if "rename_table not implemented" in str(e):
                raise NotImplementedError("rename_table not implemented") from e
            raise

    @override
    def drop_database(self):
        raise NotImplementedError(
            "drop_database is deprecated, use drop_all_tables instead"
        )

    @override
    def drop_all_tables(self, namespace_path: Optional[List[str]] = None):
        if namespace_path is None:
            namespace_path = []
        LOOP.run(self._inner.drop_all_tables(namespace_path=namespace_path))

    @override
    def list_namespaces(
        self,
        namespace_path: Optional[List[str]] = None,
        page_token: Optional[str] = None,
        limit: Optional[int] = None,
    ) -> ListNamespacesResponse:
        """
        List child namespaces under the given namespace.

View on GitHub (pinned to c7b051aff7)