summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/elements.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-12-17 15:13:39 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2013-12-17 15:13:39 -0500
commit73013914e7eae2a0480492ece085b48c5938dd84 (patch)
tree7a79331a1a2d868b83c020e0c0d1f2c83fe68f9c /lib/sqlalchemy/sql/elements.py
parent10ac89cef3dafc7a23c8947255f26d60db2c4d84 (diff)
downloadsqlalchemy-73013914e7eae2a0480492ece085b48c5938dd84.tar.gz
- rework JSON expressions to be based off __getitem__ exclusively
- add support for "standalone" JSON objects; this involves getting CAST to upgrade the given type of a bound parameter. should add a core-only test for this. - add tests for "standalone" json round trips both with and without unicode - add mechanism by which we remove psycopg2's "json" handler in order to get the effect of using our non-native result handlers
Diffstat (limited to 'lib/sqlalchemy/sql/elements.py')
-rw-r--r--lib/sqlalchemy/sql/elements.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py
index 045056b42..69e365bd3 100644
--- a/lib/sqlalchemy/sql/elements.py
+++ b/lib/sqlalchemy/sql/elements.py
@@ -1753,6 +1753,10 @@ class Cast(ColumnElement):
"""
self.type = type_api.to_instance(totype)
self.clause = _literal_as_binds(clause, None)
+ if isinstance(self.clause, BindParameter) and self.clause.type._isnull:
+ self.clause = self.clause._clone()
+ self.clause.type = self.type
+
self.typeclause = TypeClause(self.type)
def _copy_internals(self, clone=_clone, **kw):