summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/elements.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2015-08-22 12:47:13 -0400
committerStefan Urbanek <stefan@agentfarms.net>2015-08-25 23:56:13 -0700
commitcef047078ee448f1ae86af344774b3436c9a773d (patch)
tree031b2998b37a7e96e5aacb73c6e638e432b7fc58 /lib/sqlalchemy/sql/elements.py
parent656208771c43d76bfcb2c48bc200bc71596c22be (diff)
downloadsqlalchemy-cef047078ee448f1ae86af344774b3436c9a773d.tar.gz
- Added new checks for the common error case of passing mapped classes
or mapped instances into contexts where they are interpreted as SQL bound parameters; a new exception is raised for this. fixes #3321
Diffstat (limited to 'lib/sqlalchemy/sql/elements.py')
-rw-r--r--lib/sqlalchemy/sql/elements.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py
index 00c749b40..e2d81afc1 100644
--- a/lib/sqlalchemy/sql/elements.py
+++ b/lib/sqlalchemy/sql/elements.py
@@ -1145,8 +1145,7 @@ class BindParameter(ColumnElement):
_compared_to_type.coerce_compared_value(
_compared_to_operator, value)
else:
- self.type = type_api._type_map.get(type(value),
- type_api.NULLTYPE)
+ self.type = type_api._resolve_value_to_type(value)
elif isinstance(type_, type):
self.type = type_()
else:
@@ -1161,8 +1160,7 @@ class BindParameter(ColumnElement):
cloned.callable = None
cloned.required = False
if cloned.type is type_api.NULLTYPE:
- cloned.type = type_api._type_map.get(type(value),
- type_api.NULLTYPE)
+ cloned.type = type_api._resolve_value_to_type(value)
return cloned
@property