From 139143ae6213af9f080239b169570e883f31813d Mon Sep 17 00:00:00 2001 From: Morgan McClure Date: Tue, 11 Aug 2015 08:10:40 -0700 Subject: [PATCH] Import ujson when available for speed improvements on large hstore operations --- lib/_json.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/_json.py b/lib/_json.py index 26e32f2f..5224a5a2 100644 --- a/lib/_json.py +++ b/lib/_json.py @@ -34,13 +34,16 @@ from psycopg2._psycopg import new_type, new_array_type, register_type # import the best json implementation available -if sys.version_info[:2] >= (2,6): - import json -else: - try: - import simplejson as json - except ImportError: - json = None +try: + import ujson as json +except ImportError: + if sys.version_info[:2] >= (2,6): + import json + else: + try: + import simplejson as json + except ImportError: + json = None # oids from PostgreSQL 9.2