From 5159326448b6f99b734cf09844937f4ead8e5ee0 Mon Sep 17 00:00:00 2001 From: Paul Eipper Date: Wed, 3 Jul 2013 14:27:51 -0300 Subject: [PATCH] Cast dict values to string before quoting them The SQL hstore function requires key and value of type text. --- lib/extras.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/extras.py b/lib/extras.py index b21e223d..42bef7f2 100644 --- a/lib/extras.py +++ b/lib/extras.py @@ -644,7 +644,8 @@ class HstoreAdapter(object): k = _ext.adapt(self.wrapped.keys()) k.prepare(self.conn) - v = _ext.adapt(self.wrapped.values()) + values = [str(v) for v in self.wrapped.values()] + v = _ext.adapt(values) v.prepare(self.conn) return b("hstore(") + k.getquoted() + b(", ") + v.getquoted() + b(")")