--- /dev/null
+.. change::
+ :tags: bug, schema
+ :tickets: 7295
+
+ Fixed issue in :class:`.Table` where the
+ :paramref:`.Table.implicit_returning` parameter would not be
+ accommodated correctly when passed along with
+ :paramref:`.Table.extend_existing` to augment an existing
+ :class:`.Table`.
)
include_columns = kwargs.pop("include_columns", None)
-
- resolve_fks = kwargs.pop("resolve_fks", True)
-
if include_columns is not None:
for c in self.c:
if c.name not in include_columns:
self._columns.remove(c)
+ resolve_fks = kwargs.pop("resolve_fks", True)
+
for key in ("quote", "quote_schema"):
if key in kwargs:
raise exc.ArgumentError(
"Can't redefine 'quote' or 'quote_schema' arguments"
)
- if "comment" in kwargs:
- self.comment = kwargs.pop("comment", None)
-
- if "info" in kwargs:
- self.info = kwargs.pop("info")
+ # update `self` with these kwargs, if provided
+ self.comment = kwargs.pop("comment", self.comment)
+ self.implicit_returning = kwargs.pop(
+ "implicit_returning", self.implicit_returning
+ )
+ self.info = kwargs.pop("info", self.info)
if autoload:
if not autoload_replace:
):
Table("foo", MetaData(), must_exist=True)
+ @testing.combinations(
+ ("comment", ("A", "B", "A")),
+ ("implicit_returning", (True, False, True)),
+ ("info", ({"A": 1}, {"A": 2}, {"A": 1})),
+ )
+ def test_extend_attributes(self, attrib, attrib_values):
+ """
+ ensure `extend_existing` is compatible with simple attributes
+ """
+ metadata = MetaData()
+ for counter, _attrib_value in enumerate(attrib_values):
+ _extend_existing = True if (counter > 0) else False
+ _kwargs = {
+ "extend_existing": _extend_existing,
+ attrib: _attrib_value,
+ }
+ table_a = Table(
+ "a",
+ metadata,
+ Column("foo", String, primary_key=True),
+ **_kwargs
+ )
+ eq_(getattr(table_a, attrib), _attrib_value)
+ eq_(getattr(metadata.tables["a"], attrib), _attrib_value)
+
class PKAutoIncrementTest(fixtures.TestBase):
def test_multi_integer_no_autoinc(self):