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}")
+
+
[email protected]()
[email protected]("--table", "-t", multiple=True)
[email protected]("sql")
[email protected]_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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to