You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "MonkeyCanCode (via GitHub)" <gi...@apache.org> on 2026/04/12 06:46:59 UTC
[PR] Fix setup command default issue [polaris]
MonkeyCanCode opened a new pull request, #4172:
URL: https://github.com/apache/polaris/pull/4172
<!--
๐ Describe what changes you're proposing, especially breaking or user-facing changes.
๐ See https://github.com/apache/polaris/blob/main/CONTRIBUTING.md for more.
-->
The current `setup` command was serializing optional fields such as `roleArn` (reported in https://github.com/apache/polaris/pull/4167) as well as `stsEndpoint` (reported in https://github.com/apache/polaris/pull/4076). Both of them are due to `Command` dataclasses don't support default value which making almost all fields mandatory in the constructor.
While I work on the `setup` command, my assumption was default value such as `""` are safe to provide and server will handle them (miss on my end).
Now to fix this issue, this PR changes all Command dataclasses to use a flexible model by using `Optional` type hints with `None` as defaults. Then I use `__post_init__` to ensure mandatory fields are getting update to proper default values if not been implicitly defined. As they are now optional, I then ensure we have proper tests in `validation()` to cover all required fields as well as using implicitly type casting to ensure mypy is happy with these changes.
## Checklist
- [x] ๐ก๏ธ Don't disclose security issues! (contact security@apache.org)
- [x] ๐ Clearly explained why the changes are needed, or linked related issues: Fixes #
- [x] ๐งช Added/updated tests with good coverage, or manually tested (and explained how)
- [x] ๐ก Added comments for complex logic
- [x] ๐งพ Updated `CHANGELOG.md` (if needed)
- [x] ๐ Updated documentation in `site/content/in-dev/unreleased` (if needed)
--
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] Fix setup command default issue [polaris]
Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre commented on code in PR #4172:
URL: https://github.com/apache/polaris/pull/4172#discussion_r3069513092
##########
client/python/apache_polaris/cli/command/catalogs.py:
##########
@@ -490,24 +520,25 @@ def execute(self, api: PolarisDefaultApi) -> None:
properties=catalog.properties.to_dict(),
)
- api.update_catalog(self.catalog_name, request)
+ api.update_catalog(catalog_name, request)
elif self.catalogs_subcommand == Subcommands.SUMMARIZE:
self._generate_summary(api)
else:
raise Exception(f"{self.catalogs_subcommand} is not supported in the CLI")
def _generate_summary(self, api: PolarisDefaultApi) -> None:
- print(f"Catalog: {self.catalog_name}")
+ catalog_name = cast(str, self.catalog_name)
+ print(f"Catalog: {catalog_name}")
print("-" * 80)
# Metadata
- catalog = api.get_catalog(self.catalog_name)
+ catalog = api.get_catalog(catalog_name)
print("Metadata")
print(f" {'Type:':<30} {catalog.type}")
storage_info = catalog.storage_config_info
print(f" {'Storage Type:':<30} {storage_info.storage_type}")
print(f" {'Base Location:':<30} {catalog.properties.default_base_location}")
print(
- f" {'Allowed Locations:':<30} {', '.join(storage_info.allowed_locations or [])}"
+ f" {'Allowed Locations:':<30} {', '.join(storage_info.allowed_locations)}"
Review Comment:
Shouldn't we keep the `or []` here ?
If `allowed_locations` is `None` from the API response, this will crash with `TypeError: can only join an iterable`.
--
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] Fix setup command default issue [polaris]
Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on PR #4172:
URL: https://github.com/apache/polaris/pull/4172#issuecomment-4230945178
@officialasishkumar thanks for your PR in https://github.com/apache/polaris/pull/4167 and I believed this PR should addressed all of the issues in other classes as well as correct semantic for using `Optional`. Please take a look if we should proceed with this route.
@Zevrap-81, this PR should fix the problem which you are facing.
--
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] Fix setup command default issue [polaris]
Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on code in PR #4172:
URL: https://github.com/apache/polaris/pull/4172#discussion_r3070428426
##########
client/python/apache_polaris/cli/command/catalogs.py:
##########
@@ -490,24 +520,25 @@ def execute(self, api: PolarisDefaultApi) -> None:
properties=catalog.properties.to_dict(),
)
- api.update_catalog(self.catalog_name, request)
+ api.update_catalog(catalog_name, request)
elif self.catalogs_subcommand == Subcommands.SUMMARIZE:
self._generate_summary(api)
else:
raise Exception(f"{self.catalogs_subcommand} is not supported in the CLI")
def _generate_summary(self, api: PolarisDefaultApi) -> None:
- print(f"Catalog: {self.catalog_name}")
+ catalog_name = cast(str, self.catalog_name)
+ print(f"Catalog: {catalog_name}")
print("-" * 80)
# Metadata
- catalog = api.get_catalog(self.catalog_name)
+ catalog = api.get_catalog(catalog_name)
print("Metadata")
print(f" {'Type:':<30} {catalog.type}")
storage_info = catalog.storage_config_info
print(f" {'Storage Type:':<30} {storage_info.storage_type}")
print(f" {'Base Location:':<30} {catalog.properties.default_base_location}")
print(
- f" {'Allowed Locations:':<30} {', '.join(storage_info.allowed_locations or [])}"
+ f" {'Allowed Locations:':<30} {', '.join(storage_info.allowed_locations)}"
Review Comment:
Oh yeah, very sharp eyes @jbonofre . That is correct as this is not a must have field and not something users passed-in. Let me fix this shortly.
--
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] Fix setup command default issue [polaris]
Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode merged PR #4172:
URL: https://github.com/apache/polaris/pull/4172
--
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