Skip to content

Commit 3007c02

Browse files
authored
ARROW-116 Add Documentation for Auto-Discovery of Schemas (#93)
1 parent 9ec5ca8 commit 3007c02

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

bindings/python/README.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ DataFrames or NumPy arrays.
2828
1 2 16.9
2929
2 3 2.3
3030
>>> arrow_table = client.db.test.find_arrow_all({}, schema=schema)
31+
# The schema may also be omitted
32+
>>> arrow_table = client.db.test.find_arrow_all({})
3133
>>> arrow_table
3234
pyarrow.Table
3335
_id: int64

bindings/python/docs/source/quickstart.rst

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ query. We can do so using **PyMongo**::
5858

5959
Defining the schema
6060
-------------------
61-
**PyMongoArrow** relies upon a **user-specified** data schema to marshall
62-
query result sets into tabular form. Users can define the schema by
61+
**PyMongoArrow** relies upon a data schema to marshall
62+
query result sets into tabular form. This schema can either be automatically inferred from the data,
63+
or provided by the user. Users can define the schema by
6364
instantiating :class:`pymongoarrow.api.Schema` using a mapping of field names
6465
to type-specifiers, e.g.::
6566

@@ -70,6 +71,15 @@ There are multiple permissible type-identifiers for each supported BSON type.
7071
For a full-list of supported types and associated type-identifiers see
7172
:doc:`supported_types`.
7273

74+
.. note::
75+
76+
For all of the examples below, the schema can be omitted like so::
77+
78+
arrow_table = client.db.data.find_arrow_all({'amount': {'$gt': 0}})
79+
80+
In this case, PyMongoArrow will try to automatically apply a schema based on
81+
the data contained in the first batch.
82+
7383
Find operations
7484
---------------
7585
We are now ready to query our data. Let's start by running a ``find``

0 commit comments

Comments
 (0)