diff --git a/databank/utils.py b/databank/utils.py index e17bb9f..38fb8d0 100644 --- a/databank/utils.py +++ b/databank/utils.py @@ -6,6 +6,8 @@ from sqlalchemy.engine.interfaces import Dialect from sqlalchemy.sql.elements import TextClause +SUPPORTED_TYPES = (str, int, float, bool, tuple, datetime, date) + # supported types for a row value Value = Union[ str, int, float, bool, tuple, datetime, date, Literal["Jsonb"], Literal["Json"], None @@ -54,9 +56,7 @@ def serialize_param(param: Any) -> Value: Value Serialized parameter. """ - if isinstance(param, (str, int, float, bool, tuple, datetime, date)) or ( - type(param).__name__ in {"Jsonb", "Json"} - ): + if isinstance(param, SUPPORTED_TYPES) or (type(param).__name__ in {"Jsonb", "Json"}): return param elif isinstance(param, (dict, list)): return json.dumps(param) diff --git a/pyproject.toml b/pyproject.toml index 4d4479d..c562397 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "databank" -version = "0.7.0" +version = "0.8.0" description = "Databank is an easy-to-use Python library for making raw SQL queries in a multi-threaded environment." readme = "README.md" authors = ["snapADDY GmbH "]