summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2020-09-03 14:14:39 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2020-10-12 13:52:06 -0400
commit9e82f32f274e649b04740c819d21ba232c89cfff (patch)
tree15ba969d68aa914ffff413d1db3d2697761ba247 /examples
parenta3e2eb7c3c3fe6b2bebd14a7e9d661b2b4519d1f (diff)
downloadsqlalchemy-9e82f32f274e649b04740c819d21ba232c89cfff.tar.gz
Deprecate duplicated column names in Table definition
The :class:`_schema.Table` class now raises a deprecation warning when columns with the same name are defined. To replace a column a new parameter :paramref:`_schema.Table.append_column.replace_existing` was added to the :meth:`_schema.Table.append_column` method. The :meth:`_expression.ColumnCollection.contains_column` will now raises an error when called with a string, suggesting the caller to use ``in`` instead. Co-authored-by: Federico Caselli <cfederico87@gmail.com> Change-Id: I1d58c8ebe081079cb669e7ead60886ffc1b1a7f5
Diffstat (limited to 'examples')
-rw-r--r--examples/versioned_history/history_meta.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/versioned_history/history_meta.py b/examples/versioned_history/history_meta.py
index f2b3f8118..7d13f2d74 100644
--- a/examples/versioned_history/history_meta.py
+++ b/examples/versioned_history/history_meta.py
@@ -163,7 +163,8 @@ def _history_mapper(local_mapper):
if not super_history_mapper:
local_mapper.local_table.append_column(
- Column("version", Integer, default=1, nullable=False)
+ Column("version", Integer, default=1, nullable=False),
+ replace_existing=True,
)
local_mapper.add_property(
"version", local_mapper.local_table.c.version