Skip to content

Add an optional bool flag to the write function to skip writing null fields #210

@alessio-locatelli

Description

@alessio-locatelli

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions