From 39a812b1343f8b65c9eef1a4815a358b2a9e28c0 Mon Sep 17 00:00:00 2001 From: romamo Date: Wed, 4 Mar 2020 15:02:43 +0200 Subject: [PATCH] Fixed ignoring of negative enum values --- src/infi/clickhouse_orm/fields.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/infi/clickhouse_orm/fields.py b/src/infi/clickhouse_orm/fields.py index 4a4e808..bd2de33 100644 --- a/src/infi/clickhouse_orm/fields.py +++ b/src/infi/clickhouse_orm/fields.py @@ -414,7 +414,7 @@ class BaseEnumField(Field): import re from enum import Enum members = {} - for match in re.finditer("'(\w+)' = (\d+)", db_type): + for match in re.finditer("'(\w+)' = (-?\d+)", db_type): members[match.group(1)] = int(match.group(2)) enum_cls = Enum('AdHocEnum', members) field_class = Enum8Field if db_type.startswith('Enum8') else Enum16Field