How to use the graphene-sqlalchemy.graphene_sqlalchemy.converter.convert_sqlalchemy_relationship function in graphene-sqlalchemy

To help you get started, we’ve selected a few graphene-sqlalchemy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github graphql-python / graphene / graphene-sqlalchemy / graphene_sqlalchemy / types.py View on Github external
# We skip this field if we specify only_fields and is not
            # in there. Or when we excldue this field in exclude_fields
            continue
        converted_column = convert_sqlalchemy_column(column, options.registry)
        fields[name] = converted_column

    # Get all the columns for the relationships on the model
    for relationship in inspected_model.relationships:
        is_not_in_only = only_fields and relationship.key not in only_fields
        is_already_created = relationship.key in options.fields
        is_excluded = relationship.key in exclude_fields or is_already_created
        if is_not_in_only or is_excluded:
            # We skip this field if we specify only_fields and is not
            # in there. Or when we excldue this field in exclude_fields
            continue
        converted_relationship = convert_sqlalchemy_relationship(relationship, options.registry)
        name = relationship.key
        fields[name] = converted_relationship

    return fields