strawberry-sqlalchemy-mapper
Advanced tools
+1
-1
| Metadata-Version: 2.1 | ||
| Name: strawberry-sqlalchemy-mapper | ||
| Version: 0.4.5 | ||
| Version: 0.5.0 | ||
| Summary: A library for autogenerating Strawberry GraphQL types from SQLAlchemy models. | ||
@@ -5,0 +5,0 @@ Home-page: https://strawberry.rocks/ |
+1
-1
| [tool.poetry] | ||
| name = "strawberry-sqlalchemy-mapper" | ||
| packages = [ { include = "strawberry_sqlalchemy_mapper", from = "src" } ] | ||
| version = "0.4.5" | ||
| version = "0.5.0" | ||
| description = "A library for autogenerating Strawberry GraphQL types from SQLAlchemy models." | ||
@@ -6,0 +6,0 @@ authors = ["Tim Dumol <tim@timdumol.com>"] |
@@ -153,9 +153,7 @@ import ast | ||
| @classmethod | ||
| def from_type(cls, type_: type, *, strict: Literal[True]) -> Self: | ||
| ... | ||
| def from_type(cls, type_: type, *, strict: Literal[True]) -> Self: ... | ||
| @overload | ||
| @classmethod | ||
| def from_type(cls, type_: type, *, strict: bool = False) -> Optional[Self]: | ||
| ... | ||
| def from_type(cls, type_: type, *, strict: bool = False) -> Optional[Self]: ... | ||
@@ -378,3 +376,3 @@ @classmethod | ||
| def _convert_relationship_to_strawberry_type( | ||
| self, relationship: RelationshipProperty | ||
| self, relationship: RelationshipProperty, use_list: bool = False | ||
| ) -> Union[Type[Any], ForwardRef]: | ||
@@ -392,2 +390,6 @@ """ | ||
| if relationship.uselist: | ||
| # Use list if excluding relay pagination | ||
| if use_list: | ||
| return List[ForwardRef(type_name)] # type: ignore | ||
| return self._connection_type_for(type_name) | ||
@@ -530,3 +532,3 @@ else: | ||
| def connection_resolver_for( | ||
| self, relationship: RelationshipProperty | ||
| self, relationship: RelationshipProperty, use_list=False | ||
| ) -> Callable[..., Awaitable[Any]]: | ||
@@ -538,3 +540,3 @@ """ | ||
| relationship_resolver = self.relationship_resolver_for(relationship) | ||
| if relationship.uselist: | ||
| if relationship.uselist and not use_list: | ||
| return self.make_connection_wrapper_resolver( | ||
@@ -674,2 +676,3 @@ relationship_resolver, | ||
| excluded_keys = getattr(type_, "__exclude__", []) | ||
| list_keys = getattr(type_, "__use_list__", []) | ||
@@ -699,3 +702,4 @@ # if the type inherits from another mapped type, then it may have | ||
| strawberry_type = self._convert_relationship_to_strawberry_type( | ||
| relationship | ||
| relationship, | ||
| key in list_keys, | ||
| ) | ||
@@ -710,3 +714,8 @@ self._add_annotation( | ||
| StrawberryField, | ||
| field(resolver=self.connection_resolver_for(relationship)), | ||
| field( | ||
| resolver=self.connection_resolver_for( | ||
| relationship, | ||
| key in list_keys, | ||
| ) | ||
| ), | ||
| ) | ||
@@ -713,0 +722,0 @@ assert not sqlalchemy_field.init |
@@ -161,4 +161,3 @@ from __future__ import annotations | ||
| required: Literal[True], | ||
| ) -> AwaitableOrValue[Iterable[_T]]: | ||
| ... | ||
| ) -> AwaitableOrValue[Iterable[_T]]: ... | ||
@@ -178,4 +177,3 @@ | ||
| required: Literal[True], | ||
| ) -> AwaitableOrValue[Iterable[_T]]: | ||
| ... | ||
| ) -> AwaitableOrValue[Iterable[_T]]: ... | ||
@@ -195,4 +193,3 @@ | ||
| required: Literal[False], | ||
| ) -> AwaitableOrValue[Iterable[Optional[_T]]]: | ||
| ... | ||
| ) -> AwaitableOrValue[Iterable[Optional[_T]]]: ... | ||
@@ -212,4 +209,3 @@ | ||
| required: Literal[False], | ||
| ) -> AwaitableOrValue[Optional[Iterable[_T]]]: | ||
| ... | ||
| ) -> AwaitableOrValue[Optional[Iterable[_T]]]: ... | ||
@@ -236,4 +232,3 @@ | ||
| ] | ||
| ]: | ||
| ... | ||
| ]: ... | ||
@@ -315,4 +310,3 @@ | ||
| required: Literal[False] = ..., | ||
| ) -> AwaitableOrValue[Optional[_T]]: | ||
| ... | ||
| ) -> AwaitableOrValue[Optional[_T]]: ... | ||
@@ -332,4 +326,3 @@ | ||
| required: Literal[True], | ||
| ) -> AwaitableOrValue[_T]: | ||
| ... | ||
| ) -> AwaitableOrValue[_T]: ... | ||
@@ -336,0 +329,0 @@ |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
100301
0.4%2002
0.05%