You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "mattfaltyn (via GitHub)" <gi...@apache.org> on 2026/07/24 21:48:06 UTC
[PR] Export nested namespaces in setup CLI [polaris]
mattfaltyn opened a new pull request, #5147:
URL: https://github.com/apache/polaris/pull/5147
## Summary
`setup export` previously called `list_namespaces` only at the catalog root, so its output omitted every nested namespace and every policy definition stored below the top level. This made successful exports incomplete and prevented an export/apply round trip from reconstructing the full setup.
This change:
- reuses the existing namespace-only `crawl_namespace` traversal for both namespace and policy export;
- adds regression coverage for a child namespace and a policy defined within it;
- records the user-visible fix in the changelog.
Policy attachments remain outside the scope of export, as documented by the existing CLI warning.
Fixes #5146
## Validation
- `uv run pytest tests/ -q` — 163 tests and 35 subtests passed
- `uv run pre-commit run --files apache_polaris/cli/command/setup.py tests/test_setup_command.py` — all hooks passed
- `uv run pytest integration_tests/` against a freshly built local `apache/polaris:latest` image — 15 tests passed
- `./gradlew check sourceTarball distTar distZip publishToMavenLocal -x :polaris-runtime-service:test -x :polaris-admin:test -PnoIntegrationTests --continue` — 1,904 tasks, build successful
- `./gradlew :polaris-runtime-service:intTest` — build successful
- `./gradlew :polaris-relational-jdbc:test` — build successful
- `./gradlew :polaris-floci-aws-testcontainer:intTest` — build successful
- `./gradlew format compileAll` — 976 tasks, build successful
- `uv build --clear` — source distribution and wheel built successfully
## Checklist
- [x] 🛡️ Don't disclose security issues! (contact security@apache.org)
- [x] 🔗 Clearly explained why the changes are needed, or linked related issues: Fixes #5146
- [x] 🧪 Added/updated tests with good coverage, or manually tested (and explained how)
- [x] 💡 Added comments for complex logic (no new complex logic)
- [x] 🧾 Updated `CHANGELOG.md`
- [x] 📚 Updated documentation in `site/content/in-dev/unreleased` (not needed; behavior now matches the complete-export contract)
## AI assistance
Significant AI assistance was used to investigate, implement, and validate this change. I reviewed and own the final result.
--
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-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Export nested namespaces in setup CLI [polaris]
Posted by "mattfaltyn (via GitHub)" <gi...@apache.org>.
mattfaltyn commented on PR #5147:
URL: https://github.com/apache/polaris/pull/5147#issuecomment-5082202219
@MonkeyCanCode fixed conflicts
--
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-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Export nested namespaces in setup CLI [polaris]
Posted by "mattfaltyn (via GitHub)" <gi...@apache.org>.
mattfaltyn commented on code in PR #5147:
URL: https://github.com/apache/polaris/pull/5147#discussion_r3649778495
##########
client/python/apache_polaris/cli/command/setup.py:
##########
@@ -428,9 +444,7 @@ def _export_namespaces_for_catalog(
catalog_api_client = self._get_catalog_api(api)
catalog_api = IcebergCatalogAPI(catalog_api_client)
try:
- namespaces = sorted(
- catalog_api.list_namespaces(prefix=catalog_name).namespaces
- )
+ namespaces = self._list_namespaces_recursively(catalog_api, catalog_name)
Review Comment:
Thanks @MonkeyCanCode for the review. I moved the recursive namespace listing into _export_catalogs, passed the same result to the namespace and policy exporters, and updated the regression test to verify we only traverse once per catalog.
--
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-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Export nested namespaces in setup CLI [polaris]
Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on code in PR #5147:
URL: https://github.com/apache/polaris/pull/5147#discussion_r3649612998
##########
client/python/apache_polaris/cli/command/setup.py:
##########
@@ -428,9 +444,7 @@ def _export_namespaces_for_catalog(
catalog_api_client = self._get_catalog_api(api)
catalog_api = IcebergCatalogAPI(catalog_api_client)
try:
- namespaces = sorted(
- catalog_api.list_namespaces(prefix=catalog_name).namespaces
- )
+ namespaces = self._list_namespaces_recursively(catalog_api, catalog_name)
Review Comment:
Good catch on this one. As now this is doing namespace traversal, we are doing two traversal per catalog between `_export_namespaces_for_catalog` and `_export_policies_for_catalog` which can be a lot api calls for a large deployment. In that case, would suggest to call `_list_namespaces_recursively` in `_export_catalogs` once then pass in namespaces into these two functions. WDYT?
--
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-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Export nested namespaces in setup CLI [polaris]
Posted by "mattfaltyn (via GitHub)" <gi...@apache.org>.
mattfaltyn commented on code in PR #5147:
URL: https://github.com/apache/polaris/pull/5147#discussion_r3649778495
##########
client/python/apache_polaris/cli/command/setup.py:
##########
@@ -428,9 +444,7 @@ def _export_namespaces_for_catalog(
catalog_api_client = self._get_catalog_api(api)
catalog_api = IcebergCatalogAPI(catalog_api_client)
try:
- namespaces = sorted(
- catalog_api.list_namespaces(prefix=catalog_name).namespaces
- )
+ namespaces = self._list_namespaces_recursively(catalog_api, catalog_name)
Review Comment:
Thanks, @MonkeyCanCode, for the review.
I moved the recursive namespace listing into `_export_catalogs`, passed the same result to the namespace and policy exporters, and updated the regression test to verify that we only traverse once per catalog.
--
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-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Export nested namespaces in setup CLI [polaris]
Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on code in PR #5147:
URL: https://github.com/apache/polaris/pull/5147#discussion_r3650926648
##########
client/python/apache_polaris/cli/command/setup.py:
##########
@@ -428,9 +444,7 @@ def _export_namespaces_for_catalog(
catalog_api_client = self._get_catalog_api(api)
catalog_api = IcebergCatalogAPI(catalog_api_client)
try:
- namespaces = sorted(
- catalog_api.list_namespaces(prefix=catalog_name).namespaces
- )
+ namespaces = self._list_namespaces_recursively(catalog_api, catalog_name)
Review Comment:
Thanks for the fix. LGTM.
--
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-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Export nested namespaces in setup CLI [polaris]
Posted by "mattfaltyn (via GitHub)" <gi...@apache.org>.
mattfaltyn commented on code in PR #5147:
URL: https://github.com/apache/polaris/pull/5147#discussion_r3649778495
##########
client/python/apache_polaris/cli/command/setup.py:
##########
@@ -428,9 +444,7 @@ def _export_namespaces_for_catalog(
catalog_api_client = self._get_catalog_api(api)
catalog_api = IcebergCatalogAPI(catalog_api_client)
try:
- namespaces = sorted(
- catalog_api.list_namespaces(prefix=catalog_name).namespaces
- )
+ namespaces = self._list_namespaces_recursively(catalog_api, catalog_name)
Review Comment:
Thanks @MonkeyCanCode for the review.
I moved the recursive namespace listing into `_export_catalogs`, passed the same result to the namespace and policy exporters, and updated the regression test to verify that we only traverse once per catalog.
--
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-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Export nested namespaces in setup CLI [polaris]
Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode merged PR #5147:
URL: https://github.com/apache/polaris/pull/5147
--
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-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org