You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -24,7 +23,7 @@ Support for additional types will be added in subsequent releases.
24
23
* - Embedded document
25
24
- :class:`py.dict`, and instance of :class:`pyarrow.struct`
26
25
* - Embedded array
27
-
- :class:`py.list`, an instance of :class:`pyarrow.list_`,
26
+
- An instance of :class:`pyarrow.list_`,
28
27
* - ObjectId
29
28
- :class:`py.bytes`, :class:`bson.ObjectId`, an instance of :class:`pymongoarrow.types.ObjectIdType`, an instance of :class:`pymongoarrow.pandas_types.PandasObjectId`
30
29
* - Decimal128
@@ -39,6 +38,10 @@ Support for additional types will be added in subsequent releases.
39
38
- :class:`~py.int`, :class:`bson.int64.Int64`, an instance of :meth:`pyarrow.int64`
40
39
* - UTC datetime
41
40
- an instance of :class:`~pyarrow.timestamp` with ``ms`` resolution, :class:`py.datetime.datetime`
41
+
* - Binary data
42
+
- :class:`bson.Binary`, an instance of :class:`pymongoarrow.types.BinaryType`, an instance of :class:`pymongoarrow.pandas_types.PandasBinary`.
43
+
* - JavaScript code
44
+
- :class:`bson.Code`, an instance of :class:`pymongoarrow.types.CodeType`, an instance of :class:`pymongoarrow.pandas_types.PandasCode`.
42
45
43
46
Type identifiers can be used to specify that a field is of a certain type
44
47
during :class:`pymongoarrow.api.Schema` declaration. For example, if your data
@@ -54,6 +57,81 @@ respectively, and '_id' that is an `ObjectId`, your schema can be defined as::
54
57
Unsupported data types in a schema cause a ``ValueError`` identifying the
55
58
field and its data type.
56
59
60
+
61
+
Embedded Array Considerations
62
+
-----------------------------
63
+
64
+
The schema used for an Embedded Array must use the `pyarrow.list_()` type,
65
+
so that the type of the array elements can be specified. For example,
66
+
67
+
.. code-block: python
68
+
69
+
from pyarrow import list_, float64
70
+
schema = Schema({'_id': ObjectId,
71
+
'location': {'coordinates': list_(float64())}
72
+
})
73
+
74
+
75
+
Extension Types
76
+
---------------
77
+
78
+
The ``ObjectId``, ``Decimal128``, ``Binary data`` and ``JavaScript code``
79
+
are implemented as extension types for PyArrow and Pandas.
80
+
For arrow tables, values of these types will have the appropriate
81
+
``pymongoarrow`` extension type (e.g. :class:`pymongoarrow.types.ObjectIdType`). The appropriate ``bson`` Python object can be obtained using the ``.as_py()`` method,
0 commit comments