alessandro-nori commented on code in PR #1629: URL: https://github.com/apache/iceberg-python/pull/1629#discussion_r1948580037
########## pyiceberg/catalog/sql.py: ########## @@ -610,15 +610,26 @@ def list_namespaces(self, namespace: Union[str, Identifier] = ()) -> List[Identi table_stmt = select(IcebergTables.table_namespace).where(IcebergTables.catalog_name == self.name) namespace_stmt = select(IcebergNamespaceProperties.namespace).where(IcebergNamespaceProperties.catalog_name == self.name) if namespace: - namespace_str = Catalog.namespace_to_string(namespace, NoSuchNamespaceError) - table_stmt = table_stmt.where(IcebergTables.table_namespace.like(namespace_str)) - namespace_stmt = namespace_stmt.where(IcebergNamespaceProperties.namespace.like(namespace_str)) + namespace_like = Catalog.namespace_to_string(namespace, NoSuchNamespaceError) + "%" Review Comment: empirically, I found out that not adding `%` only returns the namespace itself. I think `like()` doesn't make any assumption on where the fuzzy match character should be in the string you pass so it's on the user to pass a string with `%`. I found this [example](https://docs.sqlalchemy.org/en/20/core/sqlelement.html#sqlalchemy.sql.expression.ColumnOperators.like) in the doc. Alternatively we could use [startswith](https://docs.sqlalchemy.org/en/20/core/sqlelement.html#sqlalchemy.sql.expression.ColumnOperators.startswith) which does the concatenation of the string with `%` for us. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org