@@ -74,40 +74,6 @@ schema = strawberry.Schema(
74
74
)
75
75
```
76
76
77
- Roots of polymorphic hierarchies are also expected to be registered via
78
- ` strawberry_sqlalchemy_mapper.interface() ` , and its concrete type and
79
- its descendants are expected to inherit from the interface:
80
-
81
- ``` python
82
- class Book (Model ):
83
- id = Column(UUID , primary_key = True )
84
-
85
- class Novel (Book ):
86
- pass
87
-
88
- class ShortStory (Book ):
89
- pass
90
-
91
-
92
- # in another file
93
- strawberry_sqlalchemy_mapper = StrawberrySQLAlchemyMapper()
94
-
95
- @strawberry_sqlalchemy_mapper.interface (models.Book)
96
- class BookInterface :
97
- pass
98
-
99
- @strawberry_sqlalchemy_mapper.type (models.Book)
100
- class Book :
101
- pass
102
-
103
- @strawberry_sqlalchemy_mapper.type (models.Novel)
104
- class Novel :
105
- pass
106
-
107
- @strawberry_sqlalchemy_mapper.type (models.ShortStory)
108
- class ShortStory :
109
- pass
110
- ```
111
77
112
78
Examples to help you get started are provided in the ` examples ` directory.
113
79
@@ -145,6 +111,41 @@ although support for `TypeDecorator` types is untested.
145
111
Association proxies are expected to be of the form ` association_proxy('relationship1', 'relationship2') ` ,
146
112
i.e., both properties are expected to be relationships.
147
113
114
+ Roots of polymorphic hierarchies ** are supported** , but are also expected to be registered via
115
+ ` strawberry_sqlalchemy_mapper.interface() ` , and its concrete type and
116
+ its descendants are expected to inherit from the interface:
117
+
118
+ ``` python
119
+ class Book (Model ):
120
+ id = Column(UUID , primary_key = True )
121
+
122
+ class Novel (Book ):
123
+ pass
124
+
125
+ class ShortStory (Book ):
126
+ pass
127
+
128
+
129
+ # in another file
130
+ strawberry_sqlalchemy_mapper = StrawberrySQLAlchemyMapper()
131
+
132
+ @strawberry_sqlalchemy_mapper.interface (models.Book)
133
+ class BookInterface :
134
+ pass
135
+
136
+ @strawberry_sqlalchemy_mapper.type (models.Book)
137
+ class Book :
138
+ pass
139
+
140
+ @strawberry_sqlalchemy_mapper.type (models.Novel)
141
+ class Novel :
142
+ pass
143
+
144
+ @strawberry_sqlalchemy_mapper.type (models.ShortStory)
145
+ class ShortStory :
146
+ pass
147
+ ```
148
+
148
149
## Contributing
149
150
150
151
We encourage you to contribute to strawberry-sqlalchemy-mapper! Any contributions you make are greatly appreciated.
0 commit comments