From e72c6c5e85bc124d307c97a1c8d2b640662a69d3 Mon Sep 17 00:00:00 2001 From: Bertrand Bordage Date: Fri, 2 Oct 2015 20:45:43 +0200 Subject: [PATCH] Mark datetime types as valid SQL param types (for psycopg2). --- cachalot/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cachalot/utils.py b/cachalot/utils.py index c6d5727..2ef5299 100644 --- a/cachalot/utils.py +++ b/cachalot/utils.py @@ -1,6 +1,7 @@ # coding: utf-8 from __future__ import unicode_literals +import datetime from hashlib import sha1 from time import time @@ -18,7 +19,10 @@ class UncachableQuery(Exception): pass -CACHABLE_PARAM_TYPES = (bool, int, binary_type, text_type, type(None)) +CACHABLE_PARAM_TYPES = ( + bool, int, binary_type, text_type, type(None), + datetime.date, datetime.time, datetime.datetime, datetime.timedelta +) def get_query_cache_key(compiler): """