Add mapping of field type -> py type.

This commit is contained in:
Charles Leifer
2026-03-11 18:34:27 -05:00
parent 52bb6c92f4
commit a099f10718
+29
View File
@@ -1,4 +1,7 @@
import datetime
import decimal
import re
import uuid
import warnings
from collections import OrderedDict
from collections import namedtuple
@@ -34,6 +37,32 @@ RESERVED_WORDS = set([
])
FieldTypeMap = {
'AUTO': int,
'BIGAUTO': int,
'BIGINT': int,
'BLOB': bytes,
'BOOL': bool,
'CHAR': str,
'DATE': datetime.date,
'DATETIME': datetime.datetime,
'DECIMAL': decimal.Decimal,
'DOUBLE': float,
'FLOAT': float,
'INT': int,
'SMALLINT': int,
'TEXT': str,
'TIME': datetime.time,
'UUID': uuid.UUID,
'UUIDB': bytes,
'VARCHAR': str,
'JSON': dict,
'JSONB': dict,
'TIMESTAMPTZ': datetime.datetime,
'INTERVAL': datetime.timedelta,
}
class UnknownField(object):
pass