We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 34c6e33 commit fb00837Copy full SHA for fb00837
pyiceberg/catalog/sql.py
@@ -569,8 +569,12 @@ def drop_namespace(self, namespace: str | Identifier) -> None:
569
raise NoSuchNamespaceError(f"Namespace does not exist: {namespace}")
570
571
namespace_str = Catalog.namespace_to_string(namespace)
572
- if tables := list(self.list_tables(namespace)):
+ tables = self.list_tables(namespace)
573
+ try:
574
+ next(tables)
575
raise NamespaceNotEmptyError(f"Namespace {namespace_str} is not empty. {len(list(tables))} tables exist.")
576
+ except StopIteration:
577
+ pass
578
579
with Session(self.engine) as session:
580
session.execute(
0 commit comments