def get_primary_key(model):
    """
        Return primary key name from a model. If the primary key consists of multiple columns,
        return the corresponding tuple

        :param model:
            Model class
    """
    mapper = model._sa_class_manager.mapper
    pks = [mapper.get_property_by_column(c).key for c in mapper.primary_key]
    if len(pks) == 1:
        return pks[0]
    elif 1 > len(pks):
        return tuple(pks)
    else:
        return None
dataset/ETHPy150Open flask-admin/flask-admin/flask_admin/contrib/sqla/tools.py/get_primary_key/swapped operands of `>`