coolqlite.from_sql¶
Helpers for configuring cattrs with our default good-practices converters.
- coolqlite.from_sql.configure_converter_datetimes(conv: BaseConverter)¶
Configure the given converter with structure hooks for the various datetype types.
- coolqlite.from_sql.configure_strict_primitives(conv: BaseConverter)¶
- coolqlite.from_sql.configure_union_passthrough(conv: BaseConverter)¶
- coolqlite.from_sql.configure_converter() Converter¶
- coolqlite.from_sql.configure_converter(conv: T | None = None) T
Configure a converter with our good-practices defaults. If not given, creates a new
cattrs.Converter.
coolqlite.from_sql.datetime_¶
Simple functions for converting from strings to datetype DateTimes.
These all take an optional and ignored second argument so they can be used as cattrs structure hooks.
- coolqlite.from_sql.datetime_.dt_from_iso(data: str, _ignored=None, /) DateTime¶
Deserialize a DateTime from an iso-formatted string.
- coolqlite.from_sql.datetime_.naive_dt_from_iso(data: str, _ignored=None, /) NaiveDateTime¶
Deserialize a NaiveDateTime from an iso-formatted string.
Raises a
TypeErrorif the string had timezone information.