diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-08-31 14:34:54 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-08-31 17:04:35 -0400 |
| commit | c7b9c84312b6b252e68ea704670d0ea7fc0042f0 (patch) | |
| tree | a71b8cbbb123e10a779c3a1f8efb4fc09ce47bf1 /lib/sqlalchemy/sql/schema.py | |
| parent | 53c3119ebb6801cbfcaf2841311d117eba250444 (diff) | |
| download | sqlalchemy-c7b9c84312b6b252e68ea704670d0ea7fc0042f0.tar.gz | |
Check for supports_execution at ClauseElement base
Raise a more descriptive exception / message when ClauseElement
or non-SQLAlchemy objects that are not "executable" are erroneously
passed to ``.execute()``; a new exception ObjectNotExecutableError
is raised consistently in all cases.
Change-Id: I2dd393121e2c7e5b6b9e40286a2f25670876e8e4
Fixes: #3786
Diffstat (limited to 'lib/sqlalchemy/sql/schema.py')
| -rw-r--r-- | lib/sqlalchemy/sql/schema.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/sqlalchemy/sql/schema.py b/lib/sqlalchemy/sql/schema.py index e364b2e7f..98a96fd56 100644 --- a/lib/sqlalchemy/sql/schema.py +++ b/lib/sqlalchemy/sql/schema.py @@ -71,9 +71,6 @@ class SchemaItem(SchemaEventTarget, visitors.Visitable): __visit_name__ = 'schema_item' - def _execute_on_connection(self, connection, multiparams, params): - return connection._execute_default(self, multiparams, params) - def _init_items(self, *args): """Initialize the list of child items for this SchemaItem.""" @@ -1941,6 +1938,9 @@ class DefaultGenerator(_NotAColumnExpr, SchemaItem): bind = _bind_or_error(self) return bind._execute_default(self, **kwargs) + def _execute_on_connection(self, connection, multiparams, params): + return connection._execute_default(self, multiparams, params) + @property def bind(self): """Return the connectable associated with this default.""" |
