Commit 09de790
authored
fix: show helpful error when hive catalog config is missing uri (#3077)
Closes #3069
# Rationale for this change
When a catalog is explicitly configured with `type: hive` but `uri` is
missing in `.pyiceberg.yaml`,
the CLI currently fails with a raw `KeyError('uri')`, which is surfaced
as just:
`'uri'`
```bash
❯ cat .pyiceberg.yaml
catalog:
my_hive_catalog:
type: hive
warehouse: warehouse_loc
❯ uv run pyiceberg --catalog my_hive_catalog list
'uri'
```
It's confusing for users because the command appears to return an
identifier-like value instead of
a configuration error.
This change adds explicit validation for required catalog properties
when the catalog type is already
specified (e.g. `hive`, `rest`, `sql`), so users get a clear actionable
error message instead.
## Are these changes tested?
Yes.
- Added a CLI regression test for `--catalog <name> list` with `type:
hive` and missing `uri`
- Verified the error output contains a helpful `URI missing...` message
and no longer prints `'uri'`
## Are there any user-facing changes?
Yes.
Users now see a clear error message (for example):
`URI missing, please provide using --uri, the config or environment
variable PYICEBERG_CATALOG__<CATALOG_NAME>__URI`
instead of a raw `'uri'` error when `type: hive` is configured without
`uri`.1 parent 15577e7 commit 09de790
2 files changed
+22
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
221 | 229 | | |
222 | 230 | | |
223 | 231 | | |
| |||
263 | 271 | | |
264 | 272 | | |
265 | 273 | | |
| 274 | + | |
266 | 275 | | |
267 | 276 | | |
268 | 277 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
51 | 64 | | |
52 | 65 | | |
53 | 66 | | |
| |||
0 commit comments