From 8780b7434223fb561ed354053e91d5cd4f189d94 Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Tue, 5 Jan 2016 16:17:22 +0100 Subject: [PATCH] Use deepcopy instead of copy --- openlp/core/utils/db.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/openlp/core/utils/db.py b/openlp/core/utils/db.py index 2edec4b90..8fdcbbfb9 100644 --- a/openlp/core/utils/db.py +++ b/openlp/core/utils/db.py @@ -22,11 +22,12 @@ """ The :mod:`db` module provides helper functions for database related methods. """ +import sqlalchemy import logging -log = logging.getLogger(__name__) +from copy import deepcopy -import sqlalchemy +log = logging.getLogger(__name__) def drop_columns(op, tablename, columns): @@ -36,9 +37,6 @@ def drop_columns(op, tablename, columns): From https://github.com/klugjohannes/alembic-sqlite """ - # we need copy to make a deep copy of the column attributes - from copy import copy - # get the db engine and reflect database tables engine = op.get_bind() meta = sqlalchemy.MetaData(bind=engine) @@ -49,7 +47,7 @@ def drop_columns(op, tablename, columns): select = sqlalchemy.sql.select([c for c in old_table.c if c.name not in columns]) # get remaining columns without table attribute attached - remaining_columns = [copy(c) for c in old_table.columns if c.name not in columns] + remaining_columns = [deepcopy(c) for c in old_table.columns if c.name not in columns] for column in remaining_columns: column.table = None