Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/opt/pysetup/demo/test_polars.py", line 130, in <module>
write(mongo_database().polars_places, df)
File "/opt/pysetup/.venv/lib/python3.12/site-packages/pymongoarrow/api.py", line 450, in write
_validate_schema(tabular.schema.types)
File "/opt/pysetup/.venv/lib/python3.12/site-packages/pymongoarrow/types.py", line 327, in _validate_schema
raise ValueError(msg)
ValueError: Unsupported data type "dictionary<values=large_string, indices=uint32, ordered=" in schema
[ ] "uint64"
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/opt/pysetup/demo/test_polars.py", line 131, in <module>
write(mongo_database().polars_places, df)
File "/opt/pysetup/.venv/lib/python3.12/site-packages/pymongoarrow/api.py", line 450, in write
_validate_schema(tabular.schema.types)
File "/opt/pysetup/.venv/lib/python3.12/site-packages/pymongoarrow/types.py", line 327, in _validate_schema
raise ValueError(msg)
ValueError: Unsupported data type "uint64" in schema
Update after the issue was created
I'm sorry I bothered you.
I assume I must not use
polars.Enum
or I must cast it to another type before calling thewrite
function.Duplicate issues
I did not find an open issue with a roadmap to document workarounds or add a built-in support for this.
Something related: https://github.com/mongodb-labs/mongo-arrow/issues/109, https://github.com/mongodb-labs/mongo-arrow/issues/35
Preface
This is a feature request to make the
write
function usable by supporting validpolars.DataFrame
types.An alternative option is updating the documentation with an example that shows how to deal with the natively unsupported types.
TO-DO
[ ]
Enum
[ ] "uint64"
Versions
pip show pymongoarrow
pip show polars-lts-cpu