Hello all,
I've a following piece of code that used to work fine with SA 0.6.6,
but no longer
works with 0.7 due to table.columns becoming an immutable collection.
def alterTableDropColumns(connection, table, *columns):
"""
Drop some columns of a table.
Parameters are expected to be sqlalchemy objects.
"""
statement = []
names = []
for column in columns:
if isinstance(column, sqlalchemy.Column):
name = column.name
else:
name = column
column = table.columns[name]
names.append(name)
statement.append("DROP COLUMN %s" % name)
connection.execute("ALTER TABLE %s %s" % (table.fullname,
",".join(statement)))
for name in names:
del table.columns[name]
Can anyone suggest a workaround that would let me do the same stuff in
0.7?
Maciej Szumocki
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.