diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-06-23 16:34:05 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-06-23 16:42:33 -0400 |
commit | 80b90cbcfe91e94f67d768d407fa274ec75e69cd (patch) | |
tree | 5d08e49ec24519270768643385d517d7abfd72f9 /lib/sqlalchemy/sql/schema.py | |
parent | 2f875a4b7925742b53dd8cfda1476f7f30a18f5d (diff) | |
download | sqlalchemy-80b90cbcfe91e94f67d768d407fa274ec75e69cd.tar.gz |
Add Executable to DefaultGenerator
Fixed the class hierarchy for the :class:`_schema.Sequence` and the more
general :class:`_schema.DefaultGenerator` base, as these are "executable"
as statements they need to include :class:`_sql.Executable` in their
hierarchy, not just :class:`_roles.StatementRole` as was applied
arbitrarily to :class:`_schema.Sequence` previously. The fix allows
:class:`_schema.Sequence` to work in all ``.execute()`` methods including
with :meth:`_orm.Session.execute` which was not working in the case that a
``do_orm_execute()`` handler was also established.
Fixes: #6668
Change-Id: I0d192258c7cbd1bce2552f9e748e8fdd680dc45f
Diffstat (limited to 'lib/sqlalchemy/sql/schema.py')
-rw-r--r-- | lib/sqlalchemy/sql/schema.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/sqlalchemy/sql/schema.py b/lib/sqlalchemy/sql/schema.py index 221d49db9..484cdddc8 100644 --- a/lib/sqlalchemy/sql/schema.py +++ b/lib/sqlalchemy/sql/schema.py @@ -41,6 +41,7 @@ from . import visitors from .base import _bind_or_error from .base import DedupeColumnCollection from .base import DialectKWArgs +from .base import Executable from .base import SchemaEventTarget from .coercions import _document_text_coercion from .elements import ClauseElement @@ -2464,7 +2465,7 @@ class ForeignKey(DialectKWArgs, SchemaItem): self._set_target_column(_column) -class DefaultGenerator(SchemaItem): +class DefaultGenerator(Executable, SchemaItem): """Base class for column *default* values.""" __visit_name__ = "default_generator" @@ -2678,7 +2679,7 @@ class IdentityOptions(object): self.order = order -class Sequence(IdentityOptions, roles.StatementRole, DefaultGenerator): +class Sequence(IdentityOptions, DefaultGenerator): """Represents a named database sequence. The :class:`.Sequence` object represents the name and configurational |