Fokko commented on code in PR #6590: URL: https://github.com/apache/iceberg/pull/6590#discussion_r1084938300
########## python/pyiceberg/cli/console.py: ########## @@ -365,3 +366,37 @@ def table(ctx: Context, identifier: str, property_name: str) -> None: # noqa: F ctx.exit(1) else: raise NoSuchPropertyException(f"Property {property_name} does not exist on {identifier}") + + +@run.command() +@click.option("--table", "-t", multiple=True) +@click.argument("sql") +@click.pass_context +@catch_exception() +def sql(ctx: Context, table: List[str], sql: str) -> None: + """Lists all the files of the table""" + import duckdb + + from pyiceberg.expressions import parser + + catalog, output = _catalog_and_output(ctx) + + con = duckdb.connect(database=":memory:") + for arg in table: + if "=" in arg: + ident, filter = arg.split("=", maxsplit=1) + else: + ident = arg + filter = None + + t = catalog.load_table(ident) + alias = t.name()[-1] + + scan = t.scan() Review Comment: Nit: but you could do this in a single line: ```suggestion scan = t.scan(row_filter=parser.parse(filter)) ``` -- 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-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org