SQLAlchemy mapper to Strawberry types
You can install mapper using pip:
pip install alchemy-graph
Given a SQLAlchemy model class and a Strawberry Info object representing a selection set, returns a SQLAlchemy Select object that loads only the fields and relations specified in the selection set.
- sqlalchemy_class: The SQLAlchemy model class to select fields from.
- info: The Strawberry Info object representing the selection set.
- inner_selection_name: The name of an inner selection set to consider. If specified, only fields and relations under this selection set will be included in the Select object.
A SQLAlchemy Select object that loads only the specified fields and relations.
Function maps sqlalchemy model to strawberry class.
- input_data: SqlAlchemy Base Model or list of base models.
- strawberry_type: Strawberry class wrapped in strawberry.input or strawberry.type.
Strawberry objects or list of them.
Given a Strawberry object and an optional list of allowed keys, returns a dictionary representation of the object.
obj
: A Strawberry object to convert to a dictionary.allowed_keys
: An optional list of keys to include in the output dictionary. If not specified, all keys are included.
A dictionary representation of the input object.
Function returns decorator for your Query strawberry.field().
strawberry_type
: Strawberry type that should be return. Required if result_to_strawberry=True.inject_query
: Inject into current function SqlAlchemy Query. Default value: False.sqlalchemy_class
: SqlAlchemy model class.inner_selection_name
: The name of an inner selection set to consider. If specified, only fields and relations under this selection set will be included in the Select object.result_to_strawberry
: If True, it returns Strawberry object(s). Default value: True.
Given an SQLAlchemy object, returns a dictionary representation of the object.
obj
: An SQLAlchemy object to convert to a dictionary.
A dictionary representation of the input object.
This project is licensed under the terms of the MIT license.