alessandro-nori opened a new issue, #1627:
URL: https://github.com/apache/iceberg-python/issues/1627
### Apache Iceberg version
main (development)
### Please describe the bug 🐞
When a namespace is provided as a parameter,
SqlCatalog.list_namespaces(namespace) returns the namespace itself.
```
>>> import pyiceberg
>>> pyiceberg.__version__
'0.9.0'
>>> from pyiceberg.catalog.sql import SqlCatalog
>>> catalog = SqlCatalog("example", **{"uri":"sqlite:///:memory:",
"warehouse":"/tmp/pyiceberg/warehouse"})
>>> catalog.list_namespaces()
[]
>>> catalog.create_namespace("ns1.ns2")
>>> catalog.create_namespace("ns1.ns2.ns3")
>>> catalog.list_namespaces()
[('ns1', 'ns2'), ('ns1', 'ns2', 'ns3')]
>>> catalog.create_namespace("ns1")
>>> catalog.list_namespaces()
[('ns1',), ('ns1', 'ns2'), ('ns1', 'ns2', 'ns3')]
>>> catalog.list_namespaces("ns1")
[('ns1',)]
```
## Expected behavior
Similar to other catalog implementations, calling list_namespaces with a
namespace as a parameter should return only the sub-namespaces, excluding the
namespace itself.
e.g. for other python catalogs
- GlueCatalog:
https://github.com/apache/iceberg-python/blob/7a4734e26ed64d4b37f4a722e3b710e9866073ef/tests/catalog/integration_test_glue.py#L321
- DynamoDbCatalog:
https://github.com/apache/iceberg-python/blob/7a4734e26ed64d4b37f4a722e3b710e9866073ef/tests/catalog/integration_test_dynamodb.py#L213
And the for the JdbcCatalog in Java:
- Implementation reference:
https://github.com/apache/iceberg/blob/746e71931a35e83726852a60d7ca8cb6065e334f/core/src/main/java/org/apache/iceberg/jdbc/JdbcCatalog.java#L459-L460
- UnitTest:
https://github.com/apache/iceberg/blob/41b458b7022c7b0cd78eeca9102392db7889d3c9/core/src/test/java/org/apache/iceberg/jdbc/TestJdbcCatalog.java#L747
### Willingness to contribute
- [x] I can contribute a fix for this bug independently
- [ ] I would be willing to contribute a fix for this bug with guidance from
the Iceberg community
- [ ] I cannot contribute a fix for this bug at this time
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]