Repository navigation
Conversation
| ctx.obj["catalog"] = load_catalog(ctx.obj["first_level_catalog"],**ctx.obj["properties"]) | ||
| else: | ||
| ctx.obj["catalog"] = load_catalog(ctx.obj["second_level_catalog"],**ctx.obj["properties"]) | ||
| print("cataloglll",ctx.obj["catalog"]) |
There was a problem hiding this comment.
Nit: The forgot removed print
| print("cataloglll",ctx.obj["catalog"]) |
| if ctx.obj["first_level_catalog"] is None and ctx.obj["second_level_catalog"] is None: | ||
| ctx.obj["catalog"] = load_catalog(None, **ctx.obj["properties"]) | ||
| elif ctx.obj["first_level_catalog"] is not None and ctx.obj["second_level_catalog"] is None: | ||
| ctx.obj["catalog"] = load_catalog(ctx.obj["first_level_catalog"],**ctx.obj["properties"]) | ||
| else: | ||
| ctx.obj["catalog"] = load_catalog(ctx.obj["second_level_catalog"],**ctx.obj["properties"]) |
There was a problem hiding this comment.
We can refactor as:
| if ctx.obj["first_level_catalog"] is None and ctx.obj["second_level_catalog"] is None: | |
| ctx.obj["catalog"] = load_catalog(None, **ctx.obj["properties"]) | |
| elif ctx.obj["first_level_catalog"] is not None and ctx.obj["second_level_catalog"] is None: | |
| ctx.obj["catalog"] = load_catalog(ctx.obj["first_level_catalog"],**ctx.obj["properties"]) | |
| else: | |
| ctx.obj["catalog"] = load_catalog(ctx.obj["second_level_catalog"],**ctx.obj["properties"]) | |
| catalog_option = ctx.obj.get("first_level_catalog",None) or ctx.obj.get("second_level_catalog",None) | |
| ctx.obj["catalog"] = load_catalog(catalog_option,**ctx.obj["properties"]) |
| if not isinstance(ctx.obj["catalog"], Catalog): | ||
| ctx.obj["output"].exception( | ||
| ValueError("Could not determine catalog type from uri. REST (http/https) and Hive (thrift) is supported") | ||
| ValueError("Could not determine catalog type from uri. REST (http/https) and Hive (thrift) is supported") |
There was a problem hiding this comment.
Nit: The indentation, as well as the order of imported modules, can be fixed based on the last comment.
| ValueError("Could not determine catalog type from uri. REST (http/https) and Hive (thrift) is supported") | |
| ValueError("Could not determine catalog type from uri. REST (http/https) and Hive (thrift) is supported") |
jason810496
left a comment
There was a problem hiding this comment.
The overall looks good, thanks !
Most of the nit can be resolved by autoformatting and linting via https://py.iceberg.apache.org/contributing/#linting.
make lint
Or install the pre-commit can help run these formatting on commit.
|
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that's incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@iceberg.apache.org list. Thank you for your contributions. |
|
This pull request has been closed due to lack of activity. This is not a judgement on the merit of the PR in any way. It is just a way of keeping the PR queue manageable. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time. |
Closes #1784
Rationale for this change
The command order for
pyiceberg list --catalog hivewould raise error; it should bepyiceberg --catalog hive list.Now,
pyiceberg list --catalog hivewill return the same result aspyiceberg --catalog hive list.Additionally, for cases where the catalog is not found:
For example, if the default catalog is not set and the command
pyiceberg listis executed, it will raise an error stating:Default catalog not found. Please provide a catalog type using --type.Are these changes tested?
The tests
test_no_catalog_errorandtest_list_with_catalog_option_wrong_orderintests/cli/test_console.pycover these scenarios.Additionally, I fixed
test_missing_uri. When a catalog exists but the URI is missing, it will now return an appropriate error.