Skip to content

Commit faaca60

Browse files
committed
s/prefix/warehouse
1 parent 09de790 commit faaca60

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

mkdocs/docs/cli.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ hide:
2626

2727
Pyiceberg comes with a CLI that's available after installing the `pyiceberg` package.
2828

29-
You can pass the path to the Catalog using `--uri` and `--credential`. For REST catalogs that require a path prefix, you can also set `--prefix`. It is still recommended to set up a `~/.pyiceberg.yaml` config as described in the [Catalog](configuration.md) section.
29+
You can pass the path to the Catalog using `--uri` and `--credential`. For REST catalogs, you can also set `--warehouse` to request a specific warehouse from the catalog service. It is still recommended to set up a `~/.pyiceberg.yaml` config as described in the [Catalog](configuration.md) section.
3030

3131
```sh
3232
➜ pyiceberg --help
@@ -39,7 +39,7 @@ Options:
3939
--ugi TEXT
4040
--uri TEXT
4141
--credential TEXT
42-
--prefix TEXT
42+
--warehouse TEXT
4343
--help Show this message and exit.
4444

4545
Commands:

pyiceberg/cli/console.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
from pyiceberg.catalog import URI, Catalog, load_catalog
3131
from pyiceberg.cli.output import ConsoleOutput, JsonOutput, Output
3232
from pyiceberg.exceptions import NoSuchNamespaceError, NoSuchPropertyException, NoSuchTableError
33+
from pyiceberg.io import WAREHOUSE
3334
from pyiceberg.table import TableProperties
3435
from pyiceberg.table.refs import SnapshotRef, SnapshotRefType
3536
from pyiceberg.utils.properties import property_as_int
@@ -66,7 +67,7 @@ def wrapper(*args: Any, **kwargs: Any): # type: ignore
6667
@click.option("--ugi")
6768
@click.option("--uri")
6869
@click.option("--credential")
69-
@click.option("--prefix")
70+
@click.option("--warehouse")
7071
@click.pass_context
7172
def run(
7273
ctx: Context,
@@ -77,7 +78,7 @@ def run(
7778
ugi: str | None,
7879
uri: str | None,
7980
credential: str | None,
80-
prefix: str | None,
81+
warehouse: str | None,
8182
) -> None:
8283
logging.basicConfig(
8384
level=getattr(logging, log_level.upper()),
@@ -91,8 +92,8 @@ def run(
9192
properties[URI] = uri
9293
if credential:
9394
properties["credential"] = credential
94-
if prefix:
95-
properties["prefix"] = prefix
95+
if warehouse:
96+
properties[WAREHOUSE] = warehouse
9697

9798
ctx.ensure_object(dict)
9899
if output == "text":

tests/cli/test_console.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,16 +1044,18 @@ def test_log_level_cli_overrides_env(mocker: MockFixture) -> None:
10441044
assert call_kwargs["level"] == logging.ERROR
10451045

10461046

1047-
def test_prefix_cli_option_forwarded_to_catalog(mocker: MockFixture) -> None:
1047+
def test_warehouse_cli_option_forwarded_to_catalog(mocker: MockFixture) -> None:
10481048
mock_basicConfig = mocker.patch("logging.basicConfig")
10491049
mock_catalog = MagicMock(spec=InMemoryCatalog)
10501050
mock_catalog.list_tables.return_value = []
10511051
mock_catalog.list_namespaces.return_value = []
10521052
mock_load_catalog = mocker.patch("pyiceberg.cli.console.load_catalog", return_value=mock_catalog)
10531053

10541054
runner = CliRunner()
1055-
result = runner.invoke(run, ["--catalog", "rest", "--uri", "https://example.invalid", "--prefix", "v1/ws", "list"])
1055+
result = runner.invoke(
1056+
run, ["--catalog", "rest", "--uri", "https://catalog.service", "--warehouse", "example-warehouse", "list"]
1057+
)
10561058

10571059
assert result.exit_code == 0
10581060
mock_basicConfig.assert_called_once()
1059-
mock_load_catalog.assert_called_once_with("rest", uri="https://example.invalid", prefix="v1/ws")
1061+
mock_load_catalog.assert_called_once_with("rest", uri="https://catalog.service", warehouse="example-warehouse")

0 commit comments

Comments
 (0)