syun64 commented on code in PR #305: URL: https://github.com/apache/iceberg-python/pull/305#discussion_r1466689445
########## 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: I thought about that as well, but I think the main verbiage of this code block is in avoiding pyarrow imports. If we put this block of code in pyarrow.py, I think we end up importing pyarrow, or we would end up with another: ``` if not isinstance(schema, Schema): try: import pyarrow as pa from pyiceberg.io.pyarrow import _new_schema_from_pyarrow_schema if isintance(schema, pa.Schema): schema: Schema = _new_schema_from_pyarrow_schema(schema) ... ``` So if we wanted this code block to be defined as a function, we would have to put it in a separate module where the base module imports don't include pyarrow -- 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