:small_red_triangle: alchemy_graph :small_red_triangle:
SQLAlchemy mapper to Strawberry types
✏️ Installation
You can install mapper using pip:
pip install alchemy-graph
Functions:
get_only_selected_fields
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.
Parameters:
- 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.
Returns:
A SQLAlchemy Select object that loads only the specified fields and relations.
orm_to_strawberry
Function maps sqlalchemy model to strawberry class.
Parameters:
- input_data: SqlAlchemy Base Model or list of base models.
- strawberry_type: Strawberry class wrapped in strawberry.input or strawberry.type.
Returns:
Strawberry objects or list of them.
strawberry_to_dict
Given a Strawberry object and an optional list of allowed keys, returns a dictionary representation of the object.
Parameters:
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.
Returns:
A dictionary representation of the input object.
orm_mapper
Function returns decorator for your Query strawberry.field().
Parameters:
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.
get_dict_object
Given an SQLAlchemy object, returns a dictionary representation of the object.
Parameters:
obj: An SQLAlchemy object to convert to a dictionary.
Returns:
A dictionary representation of the input object.
LICENSE
This project is licensed under the terms of the MIT license.
Metadata
Release files for alchemy-graph 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| alchemy_graph-0.1.3.tar.gz | 7.7 kB | Without provenance | Details for alchemy_graph-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| alchemy_graph-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for alchemy_graph-0.1.3-py3-none-any.whl |
Total release size: 14.4 kB
Release files / alchemy_graph-0.1.3.tar.gz
| Download URL | alchemy_graph-0.1.3.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
95d1671e4672d3f7c40b9d727d2325fc5be516e0eba58c9fd8f9281ad95395d3
|
|
BLAKE2b-256 checksum How to use checksums |
5f4cfa23f4d679f2b2ea9e0dbd30ef42ef67b4e4305495b67dcb2b95c00d1ac0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.10.2 Linux/5.15.0-1041-azure
|
Release files / alchemy_graph-0.1.3-py3-none-any.whl
| Download URL | alchemy_graph-0.1.3-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
db1bcea2c92c45ed6557c30f15d29b2d20c2acd92d041e32a450903f61b3ab2a
|
|
BLAKE2b-256 checksum How to use checksums |
3ead13e891693b0ff6ac617980e73c17d84dd1941be0b5f39e8b4af741b48f77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.10.2 Linux/5.15.0-1041-azure
|
Security for alchemy-graph 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.