grihabor opened a new issue, #1265:
URL: https://github.com/apache/iceberg-python/issues/1265

   ### Apache Iceberg version
   
   0.7.1 (latest release)
   
   ### Please describe the bug 🐞
   
   After updating pyarrow from 17.0.0 to 18.0.0, I've got this error:
   ```python
   Traceback (most recent call last):
     File 
"/home/grihabor/projects/playground/pyiceberg-pyarrow-schema/./run.py", line 
38, in <module>
       tbl = catalog.create_table(
             ^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/grihabor/projects/playground/pyiceberg-pyarrow-schema/.venv/pyarrow-18/lib/python3.12/site-packages/pyiceberg/catalog/sql.py",
 line 193, in create_table
       schema: Schema = self._convert_schema_if_needed(schema)  # type: ignore
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/grihabor/projects/playground/pyiceberg-pyarrow-schema/.venv/pyarrow-18/lib/python3.12/site-packages/pyiceberg/catalog/__init__.py",
 line 732, in _convert_schema_if_needed
       raise ValueError(f"{type(schema)=}, but it must be 
pyiceberg.schema.Schema or pyarrow.Schema")
   ValueError: type(schema)=<class 'pyarrow.lib.Schema'>, but it must be 
pyiceberg.schema.Schema or pyarrow.Schema
   ```
   
   ### Steps to reproduce
   `run.py` script:
   ```python
   import shutil
   from pyiceberg.catalog.sql import SqlCatalog
   from pathlib import Path
   import pyarrow as pa
   
   warehouse_path = Path("/tmp/warehouse")
   if warehouse_path.exists():
       shutil.rmtree(warehouse_path)
   
   Path(warehouse_path).mkdir()
   catalog = SqlCatalog(
       "default",
       **{
           "uri": f"sqlite:///{warehouse_path}/pyiceberg_catalog.db",
           "warehouse": f"file://{warehouse_path}",
       },
   )
   
   
   df = pa.Table.from_pylist(
       mapping=[
           {"city": "Amsterdam", "lat": 52.371807, "long": 4.896029},
           {"city": "San Francisco", "lat": 37.773972, "long": -122.431297},
           {"city": "Drachten", "lat": 53.11254, "long": 6.0989},
           {"city": "Paris", "lat": 48.864716, "long": 2.349014},
       ],
       schema=pa.schema(
           [
               ("city", pa.large_string()),
               ("lat", pa.float64()),
               ("long", pa.float64()),
           ]
       ),
   )
   
   
   catalog.create_namespace("db")
   tbl = catalog.create_table(
       identifier="db.cities",
       schema=df.schema,
   )
   tbl.overwrite(df)
   print(tbl.scan().to_arrow())
   ```
   This works:
   ```bash
   uv venv --python 3.12 .venv/pyarrow-17
   source .venv/pyarrow-17/bin/activate
   uv pip install pyiceberg pyarrow==17.0.0 sqlalchemy
   python ./run.py
   ```
   This throws the exception:
   ```bash
   uv venv --python 3.12 .venv/pyarrow-18
   source .venv/pyarrow-18/bin/activate
   uv pip install pyiceberg pyarrow==18.0.0 sqlalchemy
   python ./run.py
   ```


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