File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -6,14 +6,12 @@ Strawberry-sqlalchemy-mapper is the simplest way to implement autogenerated stra
6
6
7
7
- Instead of manually listing every column and relationship in a SQLAlchemy model, strawberry-sqlalchemy-mapper
8
8
lets you decorate a class declaration and it will automatically generate the necessary strawberry fields
9
- for all columns and relationships in the given model.
9
+ for all columns and relationships (subject to the limitations below) in the given model.
10
10
11
11
- Native support for most of SQLAlchemy's most common types.
12
-
13
12
- Extensible to arbitrary custom SQLAlchemy types.
14
-
13
+ - Automatic batching of queries, avoiding N+1 queries when getting relationships
15
14
- Support for SQLAlchemy >=1.4.x
16
-
17
15
- Lightweight and fast.
18
16
19
17
## Getting Started
@@ -45,6 +43,12 @@ strawberry_sqlalchemy_mapper = StrawberrySQLAlchemyMapper()
45
43
class Employee :
46
44
pass
47
45
46
+ # context is expected to have an instance of StrawberrySQLAlchemyLoader
47
+ class CustomGraphQLView (GraphQLView ):
48
+ def get_context (self ):
49
+ return {
50
+ " sqlalchemy_loader" : StrawberrySQLAlchemyLoader(),
51
+ }
48
52
49
53
# call finalize() before using the schema:
50
54
strawberry_sqlalchemy_mapper.finalize()
@@ -62,7 +66,7 @@ Roots of polymorphic hierarchies are also expected to be registered via
62
66
` strawberry_sqlalchemy_mapper.interface() ` , and its concrete type and
63
67
its descendants are expected to inherit from the interface:
64
68
65
- ```
69
+ ``` python
66
70
class Book (Model ):
67
71
id = Column(UUID , primary_key = True )
68
72
You can’t perform that action at this time.
0 commit comments