From 1007f503a623244fce6d8d1209610150d3c82dbc Mon Sep 17 00:00:00 2001 From: Matteo Campinoti Date: Thu, 2 Nov 2023 08:09:45 +0100 Subject: [PATCH] database:column - simplify if branching --- acacore/database/column.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/acacore/database/column.py b/acacore/database/column.py index df7099e..a92efcb 100644 --- a/acacore/database/column.py +++ b/acacore/database/column.py @@ -72,10 +72,7 @@ def _schema_to_column(name: str, schema: dict, defs: Optional[dict[str, dict]] = if schema.get("enum"): to_entry, from_entry = lambda e: e.value, str - elif schema_type == "object": - sql_type = "text" - to_entry, from_entry = lambda o: dumps(dump_object(o), default=str), lambda o: loads(o) - elif schema_type == "array": + elif schema_type in ("object", "array"): sql_type = "text" to_entry, from_entry = lambda o: dumps(dump_object(o), default=str), lambda o: loads(o) elif type_name in _sql_schema_type_converters: