diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-08-22 12:47:13 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-08-22 12:47:13 -0400 |
| commit | 8712ef2f81498fe59b9636ba150833d779e60781 (patch) | |
| tree | 8e42639b148196a22d930fdef851b44686886279 /lib/sqlalchemy/sql/elements.py | |
| parent | e0a8030048f4ad0690d3084929441bda4c21aba2 (diff) | |
| download | sqlalchemy-8712ef2f81498fe59b9636ba150833d779e60781.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.py | 6 |
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 |
