postgresql: identifies what adapter auto-loads json values
This commit is contained in:
+10
-5
@@ -2917,16 +2917,21 @@ class PostgreSQLAdapter(BaseAdapter):
|
|||||||
# (to be added to after_connection)
|
# (to be added to after_connection)
|
||||||
if self.driver_name == "pg8000":
|
if self.driver_name == "pg8000":
|
||||||
supports_json = self.connection.server_version >= "9.2.0"
|
supports_json = self.connection.server_version >= "9.2.0"
|
||||||
elif (self.driver_name == "psycopg2") and \
|
elif (self.driver_name == "psycopg2" and
|
||||||
(self.driver.__version__ >= "2.0.12"):
|
self.driver.__version__ >= "2.0.12"):
|
||||||
supports_json = self.connection.server_version >= 90200
|
supports_json = self.connection.server_version >= 90200
|
||||||
elif self.driver_name == "zxJDBC":
|
elif self.driver_name == "zxJDBC":
|
||||||
supports_json = self.connection.dbversion >= "9.2.0"
|
supports_json = self.connection.dbversion >= "9.2.0"
|
||||||
else: supports_json = None
|
else:
|
||||||
|
supports_json = None
|
||||||
if supports_json:
|
if supports_json:
|
||||||
self.types["json"] = "JSON"
|
self.types["json"] = "JSON"
|
||||||
self.driver_auto_json = ['loads']
|
if (self.driver_name == "psycopg2" and
|
||||||
else: LOGGER.debug("Your database version does not support the JSON data type (using TEXT instead)")
|
self.driver.__version__ >= '2.5.0'):
|
||||||
|
self.driver_auto_json = ['loads']
|
||||||
|
else:
|
||||||
|
LOGGER.debug("Your database version does not support the JSON"
|
||||||
|
" data type (using TEXT instead)")
|
||||||
|
|
||||||
def LIKE(self, first, second):
|
def LIKE(self, first, second):
|
||||||
args = (self.expand(first), self.expand(second, 'string'))
|
args = (self.expand(first), self.expand(second, 'string'))
|
||||||
|
|||||||
Reference in New Issue
Block a user