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

   ### Feature Request / Improvement
   
   The REST Catalog exposes `Table` and `TableMetadata` information as HTTP 
endpoints in JSON format 
([link](https://iceberg-rest-image.fly.dev/v1/namespaces/default/tables/taxi_dataset)).
 This information is similar to the internal state of `Table` and 
`TableMetadata` objects in Python. 
   
   It would be great to make these JSON serializable. 
   
   Example
   ```
   from pyiceberg.catalog import load_catalog
   import json
   catalog = load_catalog()
   tbl = catalog.load_table("default.taxi_dataset")
   json.dumps(vars(tbl))
   ```
   Error
   ```
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File 
"/Users/kevinliu/.pyenv/versions/3.11.0/lib/python3.11/json/__init__.py", line 
231, in dumps
       return _default_encoder.encode(obj)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/Users/kevinliu/.pyenv/versions/3.11.0/lib/python3.11/json/encoder.py", line 
200, in encode
       chunks = self.iterencode(o, _one_shot=True)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/Users/kevinliu/.pyenv/versions/3.11.0/lib/python3.11/json/encoder.py", line 
258, in iterencode
       return _iterencode(o, 0)
              ^^^^^^^^^^^^^^^^^
     File 
"/Users/kevinliu/.pyenv/versions/3.11.0/lib/python3.11/json/encoder.py", line 
180, in default
       raise TypeError(f'Object of type {o.__class__.__name__} '
   TypeError: Object of type Table is not JSON serializable
   >>> json.dumps(vars(tbl))
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File 
"/Users/kevinliu/.pyenv/versions/3.11.0/lib/python3.11/json/__init__.py", line 
231, in dumps
       return _default_encoder.encode(obj)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/Users/kevinliu/.pyenv/versions/3.11.0/lib/python3.11/json/encoder.py", line 
200, in encode
       chunks = self.iterencode(o, _one_shot=True)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/Users/kevinliu/.pyenv/versions/3.11.0/lib/python3.11/json/encoder.py", line 
258, in iterencode
       return _iterencode(o, 0)
              ^^^^^^^^^^^^^^^^^
     File 
"/Users/kevinliu/.pyenv/versions/3.11.0/lib/python3.11/json/encoder.py", line 
180, in default
       raise TypeError(f'Object of type {o.__class__.__name__} '
   TypeError: Object of type TableMetadataV1 is not JSON serializable
   ```


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