Create a schema spec from a Python type. A schema specifies what Postgres type to generate when a Python type maps to more than one (e.g. tuple -> composite, list -> array[], datetime -> timestamp[tz]). A schema for a type is represented by a tuple (type, ...) which
(self, cls: type)
| 247 | return rv |
| 248 | |
| 249 | def make_schema(self, cls: type) -> tuple[type, ...] | type | None: |
| 250 | """Create a schema spec from a Python type. |
| 251 | |
| 252 | A schema specifies what Postgres type to generate when a Python type |
| 253 | maps to more than one (e.g. tuple -> composite, list -> array[], |
| 254 | datetime -> timestamp[tz]). |
| 255 | |
| 256 | A schema for a type is represented by a tuple (type, ...) which the |
| 257 | matching make_*() method can interpret, or just type if the type |
| 258 | doesn't require further specification. |
| 259 | |
| 260 | A `None` means that the type is not supported. |
| 261 | """ |
| 262 | meth = self._get_method("schema", cls) |
| 263 | return meth(cls) if meth else cls |
| 264 | |
| 265 | def get_maker(self, spec): |
| 266 | cls = spec if isinstance(spec, type) else spec[0] |
no test coverage detected