MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_append_column_existing_key

Method test_append_column_existing_key

test/sql/test_metadata.py:2134–2144  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2132 t.append_column(Column("col", String))
2133
2134 def test_append_column_existing_key(self):
2135 t = Table("t", MetaData(), Column("col", Integer, key="c2"))
2136
2137 with testing.expect_raises_message(
2138 exc.DuplicateColumnError,
2139 r"A column with key 'c2' is already present in table 't'. "
2140 r"Specify replace_existing=True to Table.append_column\(\) or "
2141 r"Table.insert_column\(\) to "
2142 r"replace an existing column.",
2143 ):
2144 t.append_column(Column("col", String, key="c2"))
2145
2146 @testing.variation("field", ["name", "key"])
2147 def test_append_column_replace_existing(self, field: Variation):

Callers

nothing calls this directly

Calls 4

append_columnMethod · 0.95
TableClass · 0.90
MetaDataClass · 0.90
ColumnClass · 0.90

Tested by

no test coverage detected