Fokko commented on code in PR #305:
URL: https://github.com/apache/iceberg-python/pull/305#discussion_r1466683196
##########
pyiceberg/catalog/dynamodb.py:
##########
@@ -152,6 +156,14 @@ def create_table(
ValueError: If the identifier is invalid, or no path is given to
store metadata.
"""
+ if not isinstance(schema, Schema):
+ import pyarrow as pa
+
+ from pyiceberg.io.pyarrow import _ConvertToIcebergWithFreshIds,
pre_order_visit_pyarrow
+
+ if isinstance(schema, pa.Schema):
+ schema: Schema = pre_order_visit_pyarrow(schema,
_ConvertToIcebergWithFreshIds()) # type: ignore
Review Comment:
Should we also catch the exceptions when we cannot convert the schema? Also,
I think we need to add a try-except when PyArrow is not available, and we can
also raise an appropriate exception.
```suggestion
try:
import pyarrow as pa
from pyiceberg.io.pyarrow import
_ConvertToIcebergWithFreshIds, pre_order_visit_pyarrow
if isinstance(schema, pa.Schema):
schema: Schema = pre_order_visit_pyarrow(schema,
_ConvertToIcebergWithFreshIds()) # type: ignore
except ModuleNotFoundError:
# throw an appropriate error here
```
--
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]