diff options
| author | mike bayer <mike_mp@zzzcomputing.com> | 2021-04-29 21:28:19 +0000 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@ci3.zzzcomputing.com> | 2021-04-29 21:28:19 +0000 |
| commit | 8716e54b5b6d9ec20d40169de3d60db3da3ad41c (patch) | |
| tree | 582ada49c2411992b92bc3eb08cdf17fa94561fa /lib/sqlalchemy | |
| parent | 75d1a599519fde61c9ea2c9d8c935f1e420b8333 (diff) | |
| parent | 416fdb1674daf72ef215c6abfed3e08343f1e05e (diff) | |
| download | sqlalchemy-8716e54b5b6d9ec20d40169de3d60db3da3ad41c.tar.gz | |
Merge "Fix ForeignKeyConstraint.copy() error"
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/sql/schema.py | 12 | ||||
| -rw-r--r-- | lib/sqlalchemy/util/compat.py | 15 |
2 files changed, 21 insertions, 6 deletions
diff --git a/lib/sqlalchemy/sql/schema.py b/lib/sqlalchemy/sql/schema.py index f2c1c86ec..6ab58c301 100644 --- a/lib/sqlalchemy/sql/schema.py +++ b/lib/sqlalchemy/sql/schema.py @@ -2138,10 +2138,10 @@ class ForeignKey(DialectKWArgs, SchemaItem): "The :meth:`_schema.ForeignKey.copy` method is deprecated " "and will be removed in a future release.", ) - def copy(self, schema=None): - return self._copy(schema) + def copy(self, schema=None, **kw): + return self._copy(schema=schema, **kw) - def _copy(self, schema=None): + def _copy(self, schema=None, **kw): """Produce a copy of this :class:`_schema.ForeignKey` object. The new :class:`_schema.ForeignKey` will not be bound @@ -3309,7 +3309,7 @@ class ColumnCollectionConstraint(ColumnCollectionMixin, Constraint): "is deprecated and will be removed in a future release.", ) def copy(self, target_table=None, **kw): - return self._copy(target_table, **kw) + return self._copy(target_table=target_table, **kw) def _copy(self, target_table=None, **kw): # ticket #5276 @@ -3439,7 +3439,7 @@ class CheckConstraint(ColumnCollectionConstraint): "and will be removed in a future release.", ) def copy(self, target_table=None, **kw): - return self._copy(target_table, **kw) + return self._copy(target_table=target_table, **kw) def _copy(self, target_table=None, **kw): if target_table is not None: @@ -3732,7 +3732,7 @@ class ForeignKeyConstraint(ColumnCollectionConstraint): "and will be removed in a future release.", ) def copy(self, schema=None, target_table=None, **kw): - return self._copy(target_table, **kw) + return self._copy(schema=schema, target_table=target_table, **kw) def _copy(self, schema=None, target_table=None, **kw): fkc = ForeignKeyConstraint( diff --git a/lib/sqlalchemy/util/compat.py b/lib/sqlalchemy/util/compat.py index ca92fb125..727b77f7e 100644 --- a/lib/sqlalchemy/util/compat.py +++ b/lib/sqlalchemy/util/compat.py @@ -228,6 +228,10 @@ if py3k: from abc import ABC + def _qualname(fn): + return fn.__qualname__ + + else: import base64 import ConfigParser as configparser # noqa @@ -338,6 +342,17 @@ else: TYPE_CHECKING = False + def _qualname(meth): + """return __qualname__ equivalent for a method on a class""" + + for cls in meth.im_class.__mro__: + if meth.__name__ in cls.__dict__: + break + else: + return meth.__name__ + + return "%s.%s" % (cls.__name__, meth.__name__) + if py3k: |
