iceberg-python icon indicating copy to clipboard operation
iceberg-python copied to clipboard

CLI list not working

Open TiansuYu opened this issue 1 year ago • 7 comments

Apache Iceberg version

0.7.1 (latest release)

Please describe the bug 🐞

I am currently trying out the pyiceberg CLI, and found this command seems not working as expected:

pyiceberg list --uri localhost:8181

returns

URI missing, please provide using --uri, the config or environment variable PYICEBERG_CATALOG__DEFAULT__URI

The catalog instance is created from the official quickstart (can confirm it is working by spark-sql and connects to the minio instance and confirm data and metadata files are created correctly). If I understood it correctly, it exposes the catalog at 8181.

I have tried a dozens of others ports and urls (such as s3://warehouse), not working either. Seems the problem is that, the argument is simply not propagated into the config in the end somehow.

TiansuYu avatar Sep 02 '24 08:09 TiansuYu

Looks like the catalog inference code requires the URI to include http in front

https://github.com/apache/iceberg-python/blob/dc6d2429aafbffc626cba53aaac3f6198fc37eb3/pyiceberg/catalog/init.py#L198

kevinjqliu avatar Sep 02 '24 13:09 kevinjqliu

Still the same error:

pyiceberg list --uri http://localhost:8181
URI missing, please provide using --uri, the config or environment variable PYICEBERG_CATALOG__DEFAULT__URI

even if thats the case, the error message is a bit cryptic.

TiansuYu avatar Sep 02 '24 13:09 TiansuYu

can you try

pyiceberg --uri http://localhost:8181 list

from https://py.iceberg.apache.org/cli/

➜ pyiceberg --help Usage: pyiceberg [OPTIONS] COMMAND [ARGS]...

kevinjqliu avatar Sep 02 '24 13:09 kevinjqliu

even if thats the case, the error message is a bit cryptic.

agreed, the CLI needs some improvements

kevinjqliu avatar Sep 02 '24 13:09 kevinjqliu

Thanks, putting uri in front of commands worked! Another thing is

-> % pyiceberg list --help                     
URI missing, please provide using --uri, the config or environment variable PYICEBERG_CATALOG__DEFAULT__URI

I would expect this will not attempting to make any connection calls, but simply print the help message

TiansuYu avatar Sep 02 '24 13:09 TiansuYu

I would expect this will not attempting to make any connection calls, but simply print the help message

yea same, perhaps its some setting with the click lib

https://github.com/apache/iceberg-python/blob/9857107561d2267813b7ce150b01b4e6ac4b3e34/pyiceberg/cli/console.py#L107-L111

kevinjqliu avatar Sep 03 '24 18:09 kevinjqliu

I would say load_catalog lazily until actually needed, in the main command.

TiansuYu avatar Sep 04 '24 07:09 TiansuYu

This issue has been automatically marked as stale because it has been open for 180 days with no activity. It will be closed in next 14 days if no further activity occurs. To permanently prevent this issue from being considered stale, add the label 'not-stale', but commenting on the issue is preferred when possible.

github-actions[bot] avatar Mar 04 '25 00:03 github-actions[bot]

This issue has been closed because it has not received any activity in the last 14 days since being marked as 'stale'

github-actions[bot] avatar Mar 18 '25 00:03 github-actions[bot]

dup of #1784

kevinjqliu avatar Mar 18 '25 00:03 kevinjqliu