mongo-arrow
mongo-arrow copied to clipboard
Add an optional bool flag to the `write` function to skip writing `null` fields
trafficstars
Function parameters example
def write(collection, tabular, *, exclude_none: bool = False):
...
Usage example
write(collection, df, exclude_none=True)
How
Replacing https://github.com/mongodb-labs/mongo-arrow/blob/main/bindings/python/pymongoarrow/api.py#L390 with
if exclude_none:
yield {k:v for k, v in row.items() if v is not None}
else:
yield row
did the job.
Hi @olk-m! I've opened https://jira.mongodb.org/browse/ARROW-233 to track the request.