]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- pg8000 fixes for json
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 7 Jan 2016 16:04:58 +0000 (11:04 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 7 Jan 2016 16:04:58 +0000 (11:04 -0500)
lib/sqlalchemy/dialects/postgresql/pg8000.py
lib/sqlalchemy/testing/requirements.py
lib/sqlalchemy/testing/suite/test_types.py
test/requirements.py

index c71f689a3dd0707dc6ae79b98f7ceca96d6278cd..2c745e6f761e0f24b3d5b37e8c6ff0ea2d28cb68 100644 (file)
@@ -155,6 +155,7 @@ class PGDialect_pg8000(PGDialect):
             sqltypes.Numeric: _PGNumericNoBind,
             sqltypes.Float: _PGNumeric,
             JSON: _PGJSON,
+            sqltypes.JSON: _PGJSON
         }
     )
 
index 87c776e8c613ae5690b2c688d4c29fab05f2cfef..1b5d6e883b6c3094e07e7c50a38b9b2e9295dfea 100644 (file)
@@ -492,6 +492,13 @@ class SuiteRequirements(Requirements):
 
         return exclusions.closed()
 
+    @property
+    def json_array_indexes(self):
+        """"target platform supports numeric array indexes
+        within a JSON structure"""
+
+        return self.json_type
+
     @property
     def precision_numerics_general(self):
         """target backend has general support for moderately high-precision
index f2103f89abfd6fb11713cee6f691320b41e5543b..6231e0fb9ff3de80c0f4e3dca3e1d9ae6b284bb0 100644 (file)
@@ -759,6 +759,7 @@ class JSONTest(_LiteralRoundTripFixture, fixtures.TablesTest):
             "r2"
         )
 
+    @config.requirements.json_array_indexes
     def test_crit_simple_int(self):
         name = self.tables.data_table.c.name
         col = self.tables.data_table.c['data']
index 7031a70dc04aaa47c4434c68acd64b6166467f5d..522a376e00c7f215fd6ccdde3d3889fcb6a64520 100644 (file)
@@ -538,6 +538,10 @@ class DefaultRequirements(SuiteRequirements):
             "postgresql >= 9.3"
         ])
 
+    @property
+    def json_array_indexes(self):
+        return self.json_type + fails_if("+pg8000")
+
     @property
     def datetime_literals(self):
         """target dialect supports rendering of a date, time, or datetime as a