Casts date and timestamp values to string, resolves issues with out-of-range dates (e.g. BC) which psycopg can't handle
(connection)
| 41 | |
| 42 | |
| 43 | def register_typecasters(connection): |
| 44 | """Casts date and timestamp values to string, resolves issues with out-of-range |
| 45 | dates (e.g. BC) which psycopg can't handle""" |
| 46 | for forced_text_type in [ |
| 47 | "date", |
| 48 | "time", |
| 49 | "timestamp", |
| 50 | "timestamptz", |
| 51 | "bytea", |
| 52 | "json", |
| 53 | "jsonb", |
| 54 | ]: |
| 55 | connection.adapters.register_loader(forced_text_type, psycopg.types.string.TextLoader) |
| 56 | |
| 57 | |
| 58 | # pg3: I don't know what is this |