Skip to content

qjoin - join - a default value replaces None for joins that fail #8

@FabienArcellier

Description

@FabienArcellier

When a join fails, the element of the join in the final collection is None. It is possible to use another value by specifying the default parameter of the join function.

default_spacecraft_mission = {'name': None, 'mission_type': None, 'launch_date': None}

global_space_crafts = qjoin.on(spacecrafts) \
                           .join(spacecrafts_mission_infos, left='name', right='mission', default={) \
                           .all()

for spacecraft, spacecraft_mission_infos in global_space_crafts:
    print(spacecraft['name'])

documentation

  • write the section Join use default value when the join fails in User guide > Join

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions