Fokko commented on code in PR #419:
URL: https://github.com/apache/iceberg-python/pull/419#discussion_r1487641004


##########
pyiceberg/table/__init__.py:
##########
@@ -974,7 +974,7 @@ def name_mapping(self) -> NameMapping:
         else:
             return create_mapping_from_schema(self.schema())
 
-    def append(self, df: pa.Table) -> None:
+    def append(self, df: pa.Table, **snapshot_properties) -> None:

Review Comment:
   I can see that we want to add more keyword arguments later on, how about:
   ```suggestion
       def append(self, df: pa.Table, snapshot_properties: Dict[str, str] = 
EMPTY_DICT) -> None:
   ```
   
   Same goes for the rest of the API's



##########
tests/catalog/test_glue.py:
##########
@@ -671,3 +672,28 @@ def test_commit_table_properties(
     updated_table_metadata = table.metadata
     assert test_catalog._parse_metadata_version(table.metadata_location) == 1
     assert updated_table_metadata.properties == {"test_a": "test_aa", 
"test_c": "test_c"}
+
+@mock_aws
+def test_commit_table_snapshot_properties(
+    _bucket_initialize: None, moto_endpoint_url: str, table_schema_simple: 
Schema, database_name: str, table_name: str
+) -> None:
+    catalog_name = "glue"
+    identifier = (database_name, table_name)
+    test_catalog = GlueCatalog(catalog_name, **{"s3.endpoint": 
moto_endpoint_url, "warehouse": f"s3://{BUCKET_NAME}"})
+    test_catalog.create_namespace(namespace=database_name)
+    table = test_catalog.create_table(identifier=identifier, 
schema=table_schema_simple)
+
+    assert test_catalog._parse_metadata_version(table.metadata_location) == 0
+
+    table.append(
+        pa.Table.from_pylist(
+            [{"foo": "foo_val", "bar": 1, "baz": False}],
+            schema=schema_to_pyarrow(table_schema_simple),
+        ),
+        snapshot_prop_a="test_prop_a",
+    )
+
+    updated_table_metadata = table.metadata
+    assert test_catalog._parse_metadata_version(table.metadata_location) == 1
+    assert updated_table_metadata.snapshots[-1].summary.get("snapshot_prop_a") 
== "test_prop_a"

Review Comment:
   ```suggestion
       assert updated_table_metadata.snapshots[-1].summary["snapshot_prop_a"] 
== "test_prop_a"
   ```



-- 
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

Reply via email to